import java.util.TreeSet;
import java.util.Iterator;

public class IntSetTest
{
    public static void main(String[] args)
    {
	if (args.length > 0)
	    {
		System.err.println("Why did you give arguments?");
		return;
	    }

	IntSet s = new IntSetAdapter(new TreeSet<Integer>(), 0, 100);
	s.add(5);
	s.add(1);
	s.add(7);
	s.remove(5);
	if (s.contains(0))
	    {
		System.out.println("0 is an element");
	    }
	else
	    {
		System.out.println("0 is not an element");
	    }

	System.out.println(s);
	System.out.println("size = " + s.size());

	// for-each loop
	System.out.println("for-each");
	for (int x : s)
	    {
		System.out.println(x);
	    }

	// equivalent code to the above for-each; compiler automatically generates this
	System.out.println("iterators");
	Iterator<Integer> i = s.iterator();
	while (i.hasNext())
	    {
		int x = i.next();
		System.out.println(x);
	    }
	
    }
    
}
