title: What two dimensional data structure should I use which supports fixed size in Java?
body: <p>I'm writing a game which has a board:</p>
  
  <pre><code> ________
  |__|__|__|
  |__|__|__|
  |__|__|__|
  </code></pre>
  
  <p>I want to push items in each column separately from the top:</p>
  
  <pre><code> ________
  |__|__|X_| // &lt;-- pushToTop(2, item);
  |__|__|__|
  |__|__|__|
  </code></pre>
  
  <p>and/or from the bottom:</p>
  
  <pre><code> ________
  |__|__|X_|
  |__|__|__|
  |__|__|X_| // &lt;-- pushToBottom(2, item);
  </code></pre>
  
  <p>I already have an implementation which uses a 2 dimensional array which works perfectly. My problem is that I have a set of functions with code like this:</p>
  
  <pre><code>        List&lt;Card&gt; result = new ArrayList&lt;&gt;();
          for (Card[] column : board) {
              for (Card card : column) {
                  // do something
              }
          }
          return result;
  </code></pre>
  
  <p>and I want to use <code>map</code>/<code>filter</code>/<code>reduce</code> from the <em>Java 8 Stream API</em> instead of the nested for loops to process my <code>board</code>.</p>
  
  <p>My question is that what <code>Collection</code> can I use which works like an array (fixed size, I can add items based on index, I can remove items without changing the size of the array)?</p>
  
  <p><strong>Clarification:</strong> The main problem is that a primitive array can't be treated as a <code>Collection</code> thus does not take part in the <em>Stream</em> abstraction.</p>