• Post Reply Bookmark Topic Watch Topic
  • New Topic

Map, Set use cases in a general web app  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi fellas,
I am currently working on my own Java web app (to be shown in interview to get a Java job). So I've not worked on Java in professional environment, so no guidance.
I have database, entity classes, JPA relationships. Use cases are like, user has albums, album has pics, user has locations, location has co-ordinates etc. I used List (ArrayList) everywhere. I can do anything with List and DB, get some entry, find etc. For example, I will keep the list of users in List, then use queries to get some entry (why would I keep them in Map with id/email as key?).
I know very well the working and features, implementing classes of Map, Set. I can use them for solving some algorithm, processing some data etc.
In interviews, I get asked have you worked with these, where have you used them etc. So, Please tell me cases where they should be used (DB or any popular real use case).
 
Ranch Hand
Posts: 449
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my opinion, as far as you are using correct data structure, will be safe. If you read about the documentation for each data structure, you will find plenty of scenarios for each classes.
For instance, you should not use List in your code if you need unique element. Similarly, if you need order in your collection, you should know about the correct implementation of classes.
Moreover, you should also need to review for any design patterns that can be used in your requirement. Hope it helps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!