title: java - How to find matching objects between two lists?
body: <p>Given two Lists, each list holding the same object type, I would like to find objects between the two lists that match, based on some property values.</p>
  
  <p>e.g. an object from List1, L1Obj, matches an object from List2, L2Obj, if L1Obj.a == L2Obj.a AND L1Obj.b == L2Obj.c AND L1Obj.c == L2Obj.c</p>
  
  <p>These properties are not the only properties of the of the class, but are all that is needed to uniquely identify an object within a list.</p>
  
  <p>My question is - what is the best way to achieve this?</p>
  
  <p>One way would be to construct to HashMaps based on the lists, with the concataned String value of a+b+c used as the key to index an object. That way I could iterate through the first list, and attempt to lookup an object in the second list with the same key.</p>
  
  <p>How does this sound? Is there a better way of achieving this??</p>
  
  <p>All help is much appreciated!</p>
  
  <hr>
  
  <p>UPDATE:</p>
  
  <p>Okay, so actually I need a bit more. Upon finding a match, I want to overwrite properties L1Obj.x, L1Obj.y, L1Obj.z with those of L2Obj. HashSet sounds great for finding that matches, but if I'm right it doesn't actually allow me to access these matches.</p>
  
  <p>What can I do about this?</p>