Reimplement the set class from Exercise P16.15, supply an iterator method yielding an object that supports only the hasNext/next methods.

The next method should return an int, not an object. For that reason, you cannot simply return the iterator of the tree set.

Complete the following files:

IntSet.java

IntSetIterator.java

Use the following file:

IntSetTester.java

/**
   A test program for the IntSetIterator classes.
*/
public class IntSetTester
{  
   public static void main(String[] args)
   { 
      IntSet s = new IntSet();
      s.add(2002);
      s.add(2005);
      s.add(2003);
      s.add(2005);
      s.remove(2002);

      IntSetIterator iterator = s.iterator();
      System.out.println(iterator.next());
      System.out.println("Expected: 2003");
      System.out.println(iterator.hasNext());
      System.out.println("Expected: true");
      System.out.println(iterator.next() == 2005);
      System.out.println("Expected: true");
      System.out.println(iterator.hasNext());
      System.out.println("Expected: false");
   }
}