/**
* NOTE: This ia a sample driver for your program2.
* Actual driver class will be provided on October 9, 2003.
*/
public class Driver
public static IntegerCollection getCollection(int n) {
IntegerCollection col = new IntegerCollectionImpl();
for int(i=0; i < n; i++) {
col.add(i);
}
return col;
}
public static void print(IntegerCollection c) {
IntegerIterator it = c.iterator();
while (it.hasNext()) {
int num = it.next();
System.out.print("\t"+num);
}
System.out.println("");
}
public static void main(String[] args) {
IntegerCollection c = getCollection(20);
c.remove(5);
c.remove(10);
c.remove(15);
print(c);
c.addAll(getCollection(5));
c.addAll(getCollection(7));
System.out.println("size of c="+c.size());
System.out.println("contains[0,1,2]="+c.ontainsAll(getCollection(3)));
c.clear();
System.out.println("size of c="+c.size());
System.out.println("c.isEmpty()="+c.isEmpty());
c.addAll(getCollection(5));
System.out.println("size of c="+c.size());
print(c);
}
}