mardi 15 septembre 2015

How to Use Java Data Structures?

Given a zipcode and movieName the function will return list of theatres with the corresponding MovieName and zipcode?

Approach I followed:

Create two tables theatres and films and Store the data there.

Table:
theatres:                                 films     
SNO TheatreName                           SNO zipcode Moviename
1   Hari                                   1  180004  Transporter
1   Habitz                                 2  180010  Mi Impossible
2   Shakuntala

During Startup i will fetch the details from the database and put it in hashmap. My Hashmap will contains films object and corresponding list of all theatres.So When i retrieve given films object,it will give collection of all theatres.

Will this be the correct approach? The only problem with this approach is we have to maintain seperate lists theatrename for all the SNO which will consume memory. Can anyone please tell me the better approach?

Aucun commentaire:

Enregistrer un commentaire