This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What type of Collection should use?

 
Martin Vietor
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a simple question. I am writing a program that will help me set up plans for workshifts. The people who do the actual working tell me what days they can or cannot work (stored long with some other stuff in WishListType wishlist), I put that into a csv file, the file is read and then the computer can - from the list of people who could theoretically work that day - roll the dice to see who has to work. No problem so far.

In order for the plan to be fair, I have to make sure that everyone gets the same amount of weekdays, holidays, saturdays and so forth. What day is a holiday will (since that is very hard to explain to the program - changes every year in Germany) be part of the csv file. After the file is read I have a certain amount of wishlists an one String[] that contains what KIND of day each day of the year is. All this information is then returned to the core program, that called my LoadTheFile() class.

My question is therefore: What type of Collection or List or Set or Map or whatever should I use, when I want to store different types of objects - namely a bunch of WishListTypes and one String[]? Is there one where I don't have to say beforehand how many objects there will be (as with the ArrayList, I believe)?

Thank you, Martin
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martin Vietor wrote:Is there one where I don't have to say beforehand how many objects there will be (as with the ArrayList, I believe)?


Yes, with implementations of List,Map,Set etc.. you don't have to specify the size beforehand.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic