This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Performance and the fly likes Large value object with multiple array list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Large value object with multiple array list" Watch "Large value object with multiple array list" New topic

Large value object with multiple array list

sachin yadav
Ranch Hand

Joined: Nov 24, 2005
Posts: 156
Hi All,

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[1000]

MasterArraylist[1000] input to -> Stage 1 -> Stage1SuccessList[500], Stage1FailureList[500]

Stage1SuccessList[500] input to -> Stage 2 -> Stage2SuccessList[450], Stage2FailureList[50]

Stage2SuccessList[450] input to -> Stage 3 -> Stage3SuccessList[250], Stage3FailureList[200]

Stage3SuccessList[250] input to -> Stage 4 -> Stage4SuccessList[250], Stage4FailureList[0]

Stage4SuccessList[250] input to -> Stage 5 -> Stage5SuccessList[150], Stage5FailureList[100]

Now i have to consolidate whole VO list into 1 i.e. Stage1FailureList[500] + Stage2FailureList[50] + Stage3FailureList[200] + Stage4FailureList[0] + Stage5SuccessList[150] 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..
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
I agree. Here's the link:
subject: Large value object with multiple array list
It's not a secret anymore!