title: How to read a text file and produce an alphabetized vocabulary list using Scanner
body: <p>I'm trying to read a text file and produce an alphabetized vocabulary list using Scanner in Java. </p>
  
  <p>The one error that I'm receiving in Eclipse states that I must return a List of type String. I sort of understand why that error is occurring but unsure how to fix it. </p>
  
  <p>Can anyone explain to me where I'm incorrect?</p>
  
  <p>This is my current code:</p>
  
  <pre><code>public List&lt;String&gt; buildVocabulary(String fileName) {
      Scanner scanner = null;
      try {
          List&lt;String&gt; vocab = new ArrayList&lt;String&gt;();
          scanner = new Scanner(new FileReader(fileName));
          scanner.useDelimiter("[.,;']+");
          while(scanner.hasNext()) {
              vocab.add(scanner.next());
          }
          return vocab;
      } 
      catch (IOException e) {
          fail("Got an exception");
      }
      finally {
          if(scanner != null) {
              scanner.close();
          }
      }
  }
  </code></pre>
  
  <p>Test I'm trying to pass:</p>
  
  <pre><code>@Test
  public void testVocabulary() {
      List&lt;String&gt; vocab = builder.buildVocabulary("text.txt");
      assertTrue(vocab.size() == 256);
      assertTrue( vocab.get(0).equals("a"));
      assertTrue( vocab.get(255).equals("younger"));
  }
  </code></pre>