title: Modifying a dataset after setting it in an Object
body: <p>I have a Java question, but more object oriented related.</p>
  
  <pre><code>public class A {
  
      private List list;
  
      public A() {
          this.list = new ArrayList();
      }
  
      public List getList() {
          return this.list;
      }
  
      public void setList(List new_list) {
          this.list = new_list;
      }
  }
  
  public class Main {
  
      public static void main(String args[]) {
          A a = new A();
          List my_list = new ArrayList();
          a.setList(my_list);
          my_list.add("bla");
      }
  }
  </code></pre>
  
  <p>The question: Is it allowed to the caller (main() in this example) to assume that setList(...) saves the reference to the List object?</p>
  
  <p>To be specific - the last code line in the main() method - adding "bla" to my_list and assuming it will be added to A object's List as well.</p>
  
  <p>Thanks in advance.</p>