title: remove specific object does not work in Java ArrayList
body: <p>I have an <code>ArrayList</code> of object containing a reference to their parent object.</p>
  
  <p>I am trying to remove every objects within a specific parent (so equals to the parent object).</p>
  
  <p>If I do:</p>
  
  <pre><code>System.out.println(parent);
  </code></pre>
  
  <p>my console output:</p>
  
  <pre><code>ParentObject@1f8166e5
  </code></pre>
  
  <p>if I do:</p>
  
  <pre><code>for(int i = 0; i &lt; array.size(); i++){
     if(array.get(i).getParent().equals(parent)){
        array.remove(i);
     }
  }
  </code></pre>
  
  <p>And (test)</p>
  
  <pre><code>for(int i = 0; i &lt; array.size(); i++){
     if(array.get(i).getParent().equals(parent)){
        System.out.println(parent + ":" + array.get(i).getParent());
  
     }
  }
  </code></pre>
  
  <p>My console output something like:</p>
  
  <pre><code>ParentObject@1f8166e5:ParentObject@1f8166e5
  </code></pre>
  
  <p>What's wrong with the snippet above?
  Why <code>array.remove(i)</code> did not work?         </p>