add file to collections framework from file
<p>I am not trying to duplicate threads here.
My problem is i am piping in a file using msdos called amazon.txt
the file has 637 words in it..
I want a count of unique words.. and not a count of "a", "the" , "this"
which i havent counted for yet in the code..</p>

<p>when i add to a tree set it only has 8 words..
There should be atlest 300 unique words.. </p>

<p>count of total file = 637
count2 of treeset = 8 </p>

<p>I thought treeset handles duplicates? what am i doing wrong?
The file does contain some ints an $</p>

<pre><code>import java.util.Scanner;
import java.util.ArrayList;
import java.util.TreeSet;
import java.util.Iterator;
import java.util.HashSet;

public class practice1
{
    public static void main(String[] args)
    {
        Scanner     sc = new Scanner(System.in);    
        String      word;
        //String grab;
        int count = 0;
        int count2 =0;
        int count3 =0;
        int count4 =0;
        int number;
        //ArrayList&lt;String&gt; a = new ArrayList&lt;String&gt;();
        TreeSet&lt;String&gt; a = new TreeSet&lt;String&gt;();

        while (sc.hasNext()) 
        {
            word = sc.next();
            count++;           // 637 words
            a.add(word);
            if (word.equals("---"))
            {
                break;
            }
        }

        Iterator&lt;String&gt; it = a.iterator();

        while(it.hasNext())
        {
            string grab = it.next(); 
            count2++;                   // 8 words

            if (grab.equals("---"))
            {
                break;
            }
        }

        System.out.println("count2");
        System.out.println(count2);
        System.out.println("count");
        System.out.println(count);          
        System.out.println("\nbye...");
    }
}
</code></pre>
