title: How to merge two complex objects in java
body: <p>I have two java objects and I want to merge them into single object. Problem is the two objects does not contain plain primitive type properties(fields) they contain complex type properties(like object of other type and list of objects of other type). </p>
  
  <p>Object 1: Returns by setting up some properties (fields) and </p>
  
  <p>Objects 2: returns by setting up some properties (fields) or it may return new objects of the type which it holds but not returned by object 1.</p>
  
  <p>Both object 1 and object 2 are of same type.</p>
  
  <p>Result Object 3 =  obj1 properties + update the properties from obj 2 if same type as obj1  + new updated object from obj2 </p>