Problems getting Vector.remove(Vector) to work with my class

I have a class EmployeeId that has a single field, int myId. I have overridden the equals function and hashCode function and I have implemented the Comparable interface. Why does the code below print "3" instead of "2" ?

Vector<EmployeeId> vec1 =new Vector<EmployeeId>();

Vector<EmployeeId> vec2 =new Vector<EmployeeId>();

vec1.add(new EmployeeId(100));

vec1.add(new EmployeeId(200));

vec1.add(new EmployeeId(300));

vec2.add(new EmployeeId(200));

vec1.remove(vec2);

System.out.println(vec1.size());

Here is the EmployeeId class...

publicclass EmployeeIdimplements Comparable{

int myId;

/** Creates a new instance of EmployeeId */

public EmployeeId(int id){

myId = id;

}

publicint compareTo(Object eid){

return myId-((EmployeeId)eid).myId;

}

publicboolean equals(Object eid){

return ((EmployeeId)eid).myId == myId;

}

publicint hashCode(){

return myId;

}

publicint getId(){

return myId;

}

}

[2240 byte] By [jphilli9a] at [2007-11-26 17:43:01]
# 1

> vec1.add(new EmployeeId(100));

> vec1.add(new EmployeeId(200));

> vec1.add(new EmployeeId(300));

>

> vec2.add(new EmployeeId(200));

>

> vec1.remove(vec2);

vec2 isn't in vec1, so why should this statement do anything?

Do you mean vec1.removeAll(vec2) by any chance?

ejpa at 2007-7-9 0:11:12 > top of Java-index,Core,Core APIs...
# 2
thats what I meant... everything works great with removeAll (blush)
jphilli9a at 2007-7-9 0:11:12 > top of Java-index,Core,Core APIs...