Hi,
I have a two ArrayList given below as sample. AccVO: compareKey,Amount fields
List 1:
AccVO[001,500]
AccVO[002,600]
AccVO[003,800]
List2:
AccVO[001,100]
AccVO[001,100]
AccVO[001,300]
AccVO[003,300]
AccVO[003,300]
AccVO[003,200]
AccVO[005,300]
AccVO[005,300]
I have sorted the two lists. I have to compare the two lists with the compare key and fetch the records of List2 to insert into database.
Sample Code:
for(AccVO accvo1 : List1){
for(AccVO accvo2 : List2){
if(accvo1.getCmpkey().equals(accvo2.getCmpkey())){
//insert the recs into the table
}
}
}
Since my list size will be larger i.e handling millions of records, i need some optimistic logic in looping the records.
Thanking you in advance Prasanna