title: Java ArrayList Comparison- TicTacToe
body: <p>I am trying to make a really simple Tic-Tac-Toe game. I have stored values of "X" and "O" in a 0-8 ArrayList (3x3 square, essentially). I can do the following for each instance of a winning situation:</p>
  
  <pre><code>if ((newBoard().get(0)).equals("X") &amp;&amp;
      (newBoard().get(1)).equals("X") &amp;&amp; 
      (newBoard().get(2)).equals("X")){
  System.out.println("Player-X has won!");
  return true;
  </code></pre>
  
  <p>However, this is going to take a TON of code! I thought about creating new ArrayLists that contain the situations in which "X" has won (3-in-roe) and then copy and paste, replace "X" with "O", then compare these with the current ArrayList board that the user is 'interacting with.' That's all good, but I don't know how to compare them. I looked at the API, but I couldn't find anything that could do what I want, which is to compare to ArrayLists, but only for the specified indexes.</p>
  
  <p>Anything pertaining to making this situation a bit smaller, code-wise, will be greatly appreciated. Thanks!</p>