This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
The problem people have in trying to create something foolproof is that they generally underestimate the inginuity of fools.