title: How to read in multiple text-based scrabble boards, and place them into a 2D array?
body: <p>I'm currently attempting to make a scrabble solver, and I'm having a bit of an issue with the reading of the text files which represent the board. For example, I have a file like this:</p>
  <pre><code>15
  3. .. .. .2 .. .. .. 3. .. .. .. .2 .. .. 3.
  .. 2. .. .. .. .3 .. .. .. .3 .. .. .. 2. ..
  .. .. 2. .. .. .. .2 .. .2 .. .. .. 2. .. ..
  .2 .. .. 2.  l  a  u  d  a  t  o  r .. .. .2
  .. .. .. .. 2. .. ..  h .. .. 2. .. .. .. ..
  .. .3 .. .. .. .3 ..  o .. .3 .. .. .. .3 ..
  .. .. .2 .. .. .. .2  t .2 .. .. .. .2 .. ..
  3. .. .. .2 .. .. ..  i .. .. .. .2 .. .. 3.
  .. .. .2 .. .. .. .2 .. .2 .. .. .. .2 .. ..
  .. .3 .. .. .. .3 .. .. .. .3 .. .. .. .3 ..
  .. .. .. .. 2. .. .. .. .. .. 2. .. .. .. ..
  .2 .. .. 2. .. .. .. .2 .. .. .. 2. .. .. .2
  .. .. 2. .. .. .. .2 .. .2 .. .. .. 2. .. ..
  .. 2. .. .. .. .3 .. .. .. .3 .. .. .. 2. ..
  3. .. .. .2 .. .. .. 3. .. .. .. .2 .. .. 3.
  le*mdoe
  7
  3. .. .. 2. .. .. 3.
  .. .3 .. .. .. .3 ..
  .. ..  a  d .2 .. ..
  2. ..  u  h .. .. 2.
  .. ..  l  o .2 .. ..
  ..  m  a  t .. .3 ..
   r  e  S  i  d .. 3.
  toloeri
  21
  4. .. .. .2 .. .. .. 3. .. .. .2 .. .. 3. .. .. .. .2 .. .. 4.
  .. 2. .. .. .3 .. .. .. 2. .. .. .. 2. .. .. .. .3 .. .. 2. ..
  .. .. 2. .. .. .4 .. .. .. 2. .. 2. .. .. .. .4 .. .. 2. .. ..
  .2 .. .. 3. .. .. .2 .. .. .. 3. .. .. .. .2 .. .. 3. .. .. .2
  .. .3 .. .. 2. .. .. .. .3 .. .. .. .3 .. .. .. 2. .. .. .3 ..
  .. .. .4 .. .. 2. .. .. .. .2 .. .2 .. .. .. 2. .. .. .4 .. ..
  .. .. .. .2 .. .. 2.  q  u  e  p .. .. .. 2. .. .. .2 .. .. ..
  3. .. .. .. .. ..  l  i .. .. .. .. .. 2. .. .. .. .. .. .. 3.
  ..  g  l  i  t ..  a .. .3 .. .. .. .3 .. .. .. .3 .. .. 2. ..
  .. ..  a .. .. .2  u ..  n .2 .. .2 .. .. .. .2 .. .. 2. .. ..
   d  a  w  d .. ..  d  h  o  t  i .. .. .. .2 .. .. 3. .. .. .2
  .. ..  f  i  g  j  a  m  s .2 .. .2 .. .. .. .2 .. .. 2. .. ..
  ..  t  u  n  e ..  t ..  y .. .. .. .3 .. .. .. .3 .. .. 2. ..
   m  e  l  o  d  e  o  N .. .. .. .. .. 2. .. .. .. .. .. .. 3.
  .. .. .. .2 .. ..  r .. .. .. .2 .. .. .. 2. .. .. .2 .. .. ..
  ..  v  e  z  i  r  s .. .. .2 .. .2 .. .. .. 2. .. .. .4 .. ..
  .. .3 ..  o 2. .. .. .. .3 .. .. .. .3 .. .. .. 2. .. .. .3 ..
  .2  b  a  r  f .. .2 .. .. .. 3. .. .. .. .2 .. .. 3. .. .. .2
  .. ..  a  r  o  w .. .. .. 2. .. 2. .. .. .. .4 .. .. 2. .. ..
  .. 2. ..  o  x  y .. .. 2. .. .. .. 2. .. .. .. .3 .. .. 2. ..
   k  e  p  s ..  n .. 3. .. .. .2 .. .. 3. .. .. .. .2 .. .. 4.
  ntnbtoi
  15
  3. .. .. .2 .. .. .. 3. .. .. .. .2 .. .. 3.
  .. 2. .. .. .. .3 .. .. .. .3 .. .. .. 2. ..
  .. .. 2. .. .. .. .2 .. .2 .. .. .. 2. .. ..
  .2 .. .. 2. .. .. .. .2 .. .. .. 2. .. .. .2
  .. .. .. .. 2. .. .. .. .. .. 2. .. .. .. ..
  .. .3 .. .. .. .3 .. .. .. .3 .. .. .. .3 ..
  .. .. .2 .. .. .. .2 .. .2 .. .. .. .2 .. ..
  3. .. .. .2 ..  c  a  t .. .. .. .2 .. .. 3.
  .. .. .2 .. .. .. .2 .. .2 .. .. .. .2 .. ..
  .. .3 .. .. .. .3 .. .. .. .3 .. .. .. .3 ..
  .. .. .. .. 2. .. .. .. .. .. 2. .. .. .. ..
  .2 .. .. 2. .. .. .. .2 .. .. .. 2. .. .. .2
  .. .. 2. .. .. .. .2 .. .2 .. .. .. 2. .. ..
  .. 2. .. .. .. .3 .. .. .. .3 .. .. .. 2. ..
  3. .. .. .2 .. .. .. 3. .. .. .. .2 .. .. 3.
  dgos*ie
  </code></pre>
  <p>The first line above the board is the number of rows/columns. Then, obviously, the board. Then the hand with which to place characters.</p>
  <p>The thing that I am trying to implement is a way to separate each board from each other, and solve them independently. I'm unsure how to use a scanner to, for example, stop after reading the row/column number, create the corresponding 2D array, then read the board in and stop before the hand, and then read the hand and place them into the Hand object, and then continue with the next board. I'm not sure how to make the divisons, if that makes sense.</p>
  <p>Here is my attempt, that only kind of works. I can only get it to work if I delete the first line, and have just a single board. The lines that are commented out at the top are my attempt to read just the first line, and create the corresponding array, but whenever I do this, for my <code>input</code> ArrayList, the first sysout is a blank list, and only then does it start reading the board itself, which doesn't make any sense to me.</p>
  <pre><code>public static void populateBoard(File file) throws FileNotFoundException {
          Scanner scan = new Scanner(file);
  //        String NUMBER_ROWS = scan.next();
  //        System.out.println(NUMBER_ROWS);
  
  //        board = new String[NUMBER_ROWS][NUMBER_ROWS];
          board = new String[15][15];
          int actualLine = 0;
  
          while(actualLine &lt; 15) {
              ArrayList&lt;String&gt; input = new ArrayList&lt;&gt;(Arrays.asList(scan.nextLine().split(&quot; &quot;)));
              // Removes blank characters which occur because of the letters on the board having a space instead
              // of a dot to their left.
              input.removeIf(string -&gt; string.equals(&quot;&quot;));
              System.out.println(input.toString());
  
              for(int i = 0; i &lt; input.size(); i++) {
                  board[actualLine][i] = input.get(i);
              }
              actualLine++;
          }
  
      }
  </code></pre>
  <p>I feel that I haven't explained this overly well, so if there is anything that I can clarify, please ask, and I will do so.</p>