title: Can not remove an object into a ArrayList
body: <p>I don't know how to remove an object from an <code>ArrayList</code>. I know there is remove but in my case, its more complicate. </p>
  
  <p>I have a <code>ArrayList</code> (listsBlocksRemaining), which contains object that I put into another <code>ArrayList</code> (listBlocksIntoRibbon) when there are print. Then, what I want, its that the object that are print should be removed from listBlocksRemaining, there are print so no more remaining.</p>
  
  <p>This is my code :</p>
  
  <pre><code>public void algoGlouton(Graphics g) {
  
      int offsetX = 13;
      int offsetY = 600;
      int widthAvailable= 0;
      int smallestHeight= 300;
      for(Bloc b : listsBlocksRemaining) {
          if(widthRemaining+b.getWidth () &lt; ribbon.getWidth ()) {
              widthAvailable+= b.getWidth();
               g.setColor(b.getColor());
               g.fillRect(offsetX, offsetY-b.getHeight(), b.getWidth(), b.getHauteur());
               listBlocksIntoRibbon.add(b);
               b.setX(offsetX);
               b.setY(offsetY-b.getHauteur());
               offsetX += b.getLargeur();
          } else {
              for(Bloc b1 : listBlocksIntoRibbon) {
                  if(b1.getHauteur() &lt; smallestHeight) {
                      smallestHeight= b1.getHeight();
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>I tried this :</p>
  
  <pre><code>for(int i = 0; i&lt;listsBlocksRemaining.size();i++) {
          for(int j = 0; j&lt;listBlocksIntoRibbon.size();j++) {
              if(listsBlocksRemaining.get(i) == listBlocksIntoRibbon.get(j)) {
                  listsBlocksRemaining.remove(i);
              }
          }
  }
  </code></pre>
  
  <p>and this :</p>
  
  <pre><code>for(int i = 0; i&lt;listsBlocksRemaining.size();i++) {
          Bloc b = listsBlocksRemaining.get(i);
          if(listBlocksIntoRibbon.equals(b)) {
              listsBlocksRemaining.remove(b);
          }
  }
  </code></pre>
  
  <p>Cordially</p>