import java.util.*;

public class IntCompare implements Comparator {

    public int compare(Object x,Object y){
	int i = ((Integer)x).intValue(),
	    j = ((Integer)y).intValue();
        return (j - i);
    }

    public boolean equals(Object x){
	return equals(x);
    }


    public static void main(String[] args) {
	IntCompare c = new IntCompare();
	TreeSet    S = new TreeSet(c);
	for (int i=0;i<10;i++) S.add(new Integer(i));
	for (int i=0;i<10;i++) S.add(new Integer(i));
	System.out.println("size: " +  S.size() + " S = " + S);
	Iterator setIter = S.iterator();
	while (setIter.hasNext()) System.out.println(setIter.next());

	S.remove(new Integer(5));
	System.out.println("size: " +  S.size() + " S = " + S);
	
    }
}
	    
