Finding and Updating List from another List

I have two list. Lets say .. List A - a,b,c,d,e,f,(attributes) List B- b,d,f (attributes) I want find an object from List A by using an objB one by one if objA (b,d,f)=objB(b,d,f) then update objA(a,c) What would be the better approach to find and update List from another List? Both list have 1,000,000 data and I need to do this operation after every 15 mins.
1 answers

You can use any of the list operations like

  • intersect, (b,c,d,e) intersect (a,b,d) = (b,d)
  • union, (b,c,d,e) union (a,b,d) = (a,b,c,d,e)
  • subtract (b,c,d,e) subtract (a,b,d) = (c,e)
  • contains (a,b,c) contains (a,b) = true
  • equals (a,b,c) equals (a,b,c,d) = false and (a,b,c) equals (a,b,c) = true

EDIT: As Erwin says do not load a list of a million objects in memory. Combine the attributes in one attributes and do a search in database with that combined attribute. Process only new or changed objects.