• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Large value object with multiple array list

 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
List.addAll()
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic