title: Make arraylists from arraylist
body: <p>I have an arraylist that was made from importing a file. I now want to separate this list into smaller arraylists by category. The code I have for the original arraylist is as follows:</p>
  
  <pre><code>public class TriviaGamePlayer {
  
  public static void main(String[] args) throws IOException {
  File gameFile = new File("trivia.txt");
  
  List&lt;TriviaGame&gt; triviaQuestions = new ArrayList&lt;TriviaGame&gt;();
  Scanner infile = new Scanner(gameFile);
  String lastKnownCategory = "";
  
  while (infile.hasNextLine()) {
      String currentLine = infile.nextLine();
  
      if (!currentLine.isEmpty()) {
          TriviaGame currentQuestion = new TriviaGame();
  
          if (currentLine.endsWith("?")) {
              currentQuestion.setCategory(lastKnownCategory);
              currentQuestion.setQuestion(currentLine);
              currentQuestion.setAnswer(infile.nextLine());
          } else {
              currentQuestion.setCategory(currentLine);
              currentQuestion.setQuestion(infile.nextLine());
              currentQuestion.setAnswer(infile.nextLine());
              lastKnownCategory = currentLine;
          }
          triviaQuestions.add(currentQuestion);
      }
  }
  
  infile.close();
  
  
  
  System.out.println(triviaQuestions);
  </code></pre>
  
  <p>This will display [category=Arts &amp; Literature, question=What are bongo drums traditionally held between for playing?, answer=The knees] There are a bunch more followed by it in different categories. From here i want to make different arraylists for each category and be able to pick out category, question and answer.
  Thanks</p>