title: Loop becomes Infinite when System.out.println() is added
body: <p>I am working on a Swing Ti-Tac-Toe variation game. In the AI class I have a function that takes the board and a piece <code>morpionType</code>. It loops through all the available spots <code>intersections</code> on the board and returns the number of intersections which yield game over. It was behaving oddly so I decided to print out a statement from within the for loop. When I do that the loop becomes infinite. </p>
  
  <p>The code is inside the Event Dispatch Thread. I can't realistically post the whole project so here is the piece of code. </p>
  
  <pre><code>public ArrayList&lt;Point&gt; check4WinIn1(Board board, MorpionType morpionType)
  {
      ArrayList&lt;Point&gt; winningIntersections=new ArrayList&lt;&gt;();
      int counter=0;
  
      for(Point intersection: board.listOfAvailableIntersections)
      {
          //System.out.println("Testing!!! Testing!!!!"); 
          if(board.check4GameOver(new Morpions(morpionType, intersection, board.morpionRadius, board.getGameCounter()))) 
          {
              winningIntersections.add(intersection);
              if(winningIntersections.size()==2)
                  return winningIntersections;     
          }
      }
  
      return winningIntersections;
  }
  </code></pre>
  
  <p>Thanks in advance!!!</p>