title: Returning const reference of an arraylist
body: <p>I really admire java features and I don't want to give up using it for the next problem:</p>
  
  <p>I have a class that might be inherited, and inside of it is a <code>private ArrayList arr;</code> So the setter function is ok , but the getter function <code>return arr;</code> returns the reference to that variable which anyone capable of editing that whole array which I don't want and private wouldn't make any sense !</p>
  
  <p>In C++ I would just <code>return const arr;</code> and it would return constant reference to the variable.</p>
  
  <p>I so much need the variable not to be cloned or manually copied because there are so many calculations that require to (READ ONLY the variable) WHY there is no const returning in java ????  is there any way I could escape copying ?</p>
  
  <p>p.s <code>(final ArrayList&lt;Integer&gt; arr;)</code> isn't an option cause that array always changes size or element values.</p>
  
  <p>If I couldn't find a fix to that I'm threatening to go back to C++ or make everything public and you should never get my software :D </p>
  
  <hr>
  
  <p>EDIT: one more important question: Am I asking for something that's not good (Software engineering wise) I mean if JAVA creators thought of not having const reference (returning Read only references) then I must be asking for something that can be handled in other way. or my program design is wrong I'm so confused.</p>