This week's book giveaway is in the Other Open Source APIs forum. We're giving away four copies of Storm Applied and have Sean Allen, Peter Pathirana & Matthew Jankowski on-line! See this thread for details.
I have an Arraylist of 1000 value objects. This array list has to pass through 5 stages and at each stage we will get a success list and a failuer list. After all stages i have to persist status of all 1000 value objects in database. Let's see this with an example
Start -> MasterArraylist
MasterArraylist input to -> Stage 1 -> Stage1SuccessList, Stage1FailureList
Stage1SuccessList input to -> Stage 2 -> Stage2SuccessList, Stage2FailureList
Stage2SuccessList input to -> Stage 3 -> Stage3SuccessList, Stage3FailureList
Stage3SuccessList input to -> Stage 4 -> Stage4SuccessList, Stage4FailureList
Stage4SuccessList input to -> Stage 5 -> Stage5SuccessList, Stage5FailureList
Now i have to consolidate whole VO list into 1 i.e. Stage1FailureList + Stage2FailureList + Stage3FailureList + Stage4FailureList + Stage5SuccessList and persist this status into database.
Main problem is after last phase i have to merge all the results in main value object. I do not want to use for loops. Can someone suggest an efficient way other then cloning to merge all these results in one main list..