title: copying objects with data fields
body: <p>I need to copy all content of class object to new class object. I don't need to copy references to data, because in that case if I change fields in object a2 those data will be changed in object a2.</p>
  
  <pre><code>public class Msg {
      String info="";
      HashMap fld = new HashMap();
  
      public void assign(Msg value) {
          info = value.infol;
          fld = value.fld;
      }
  
  }
  
  // Do stuff with class
  a1 = new Msg();
  a1.info="111";
  a1.fld.put("1","111");
  
  a2 = new Msg();
  a2.assign(a1);
  </code></pre>
  
  <p>How to realise function <code>assign</code>?</p>