• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

What type of Collection should use?

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 4109
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic