title: Find the unique words in a text file
body: <p>I'm writing this program in Java to find the unique words in a text file. I want to know if this code is correct as it shows even spaces as words.</p>
  
  <pre><code>String[] words;
  List&lt;String&gt; uniqueWords = new ArrayList&lt;String&gt;();
  words = str1.split("[!-~]* ");
  for (int i = 0; i &lt; words.length; i++)
  {
      if (!(uniqueWords.contains (words[i])))
      {
          uniqueWords.add(words[i]);
      }
  }
  </code></pre>
  
  <p>For example, if my input is "Hello world! How is the world?" my output array/set/list should have hello, world, how, is, the</p>