This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Thank you in advance for the assistance. I have a code that I must edit. Currently it features a LinkedList structure with multiple methods throughout various classes adding data into this LinkedList and then printed at the end. I am tasked with changing this so, instead of these methods adding data to the LinkedList throughout the program, it only adds the data at the end (in a separate test class). My trouble is that this structure makes perfect sense to me so I don't know where to start. How do I get data from different methods into this LinkedList without continuously appending it as the methods are executed?
The only thing I can think of seems too obvious to be the answer, but you haven't given a lot of details about why someone wants you to do this. It is possible they didn't give you many details either.
If for some reason they want a linked list that gets all its additions "all at once", and the various additions all come from different methods, then all I can think of is to accumulate them in a different linked list, and then transfer them from one to the other "all at once".
I suppose if someone wanted to lock the linked list from alterations before the first addition until after the last one, but didn't want to lock for execution of all the methods, then it might make sense to do this. But it's just a shot in the dark.