title: Collections addAll method for a set of unique values
body: <p>I am trying to find number of unique characters in a String.  Solution have to be as efficient (time complexity O(N); very big arrays; in general Big O) as possible.  I have decided to do it this way (if you have any better solution please let me know).  The only problem is that when I try to run it it always says there is only one distinct value.  It seems there is a problem with the <code>Collections.addAll</code> method (maybe am using it wrong).  Please let me know how to fix it.  It seems it is only taking first character in an array.  Thank you.</p>
  
  <pre><code>    String ds = "acvdgefav";
      char[] sa = ds.toCharArray();   
  
      for (int i=0; i&lt;sa.length; i++)
          System.out.println(sa[i]);
      System.out.println();
      System.out.println(sa.length);
      System.out.println();
  
      HashSet hs = new HashSet();
      Collections.addAll(hs, sa);
      for (int i=0; i&lt;hs.size(); i++)
          System.out.println(sa[i]);
      System.out.println();
      int z = hs.size();
      System.out.println(z);
  </code></pre>