title: passing objects by value in java
body: <p>so suppose i have </p>
  
  <pre><code>ArrayList&lt;E&gt; X = new ArrayList&lt;E&gt;();
  </code></pre>
  
  <p>and I pass X into some parameter:</p>
  
  <pre><code>Something Y = new Something(X);
  </code></pre>
  
  <p>it will pass X by reference rather than by value and I don't want this....class Something has a field with Arraylist type that is supposed to be distinct to itself and I don't want to go and iterate through the damn arraylist and set it individually just to instantiate the field...</p>
  
  <p>is there a way to easily make Java pass any object parameters by value rather than reference without having have to implement cloneable interface on all my objects which is a pain in the butt</p>