title: Object[ ][ ] to a linked collection in Java
body: <p>I have a array 2D of CellPanes, filled randomly. 
  Background is a instance variable of CellPane, of type Color. How to remove elements that share the same value of Background?</p>
  
  <p><code>
      public CellPane[][] board = new CellPane[ROWS][COLS];
      private static final int ROWS = 4;
      private static final int COLS = 4;
      GridBagConstraints gbc;</code></p>
  
  <pre><code>public class CellPane extends JPanel
  {
  
      /**
       * 
       */
      private static final long serialVersionUID = 1L;
      public ArrayList&lt;Color&gt; cores = new ArrayList&lt;Color&gt;();
      private Color Background;
  </code></pre>
  
  <p>In ArrayList cores, I have the Colors that I want the Background var to have.
  So, each element in array board have a different Background color. Now I want to make that if a element is selected, all elements adjacent to the original are removed, or changed to null. It's this part of linking elements that share the same value in Background that I need to do, but the elements must have the same position. Is it still unclear? Please comment if its unclear, I will try harder</p>