The same code can be use for the removeAll on the List.
Results:
****** Starting tests ******
>>> list2.removeAll(firstList): 5717
>>> list3.remove *16000 (firstList): 120
>>> list4.removeAll(new HashSet<
String>(firstList)): 151
>>> theSet.removeAll(firstList): 5581
>>> theSet2.remove *16000 (firstList): 3
>>> theSet3.removeAll handcoded(firstList): 5609
>>> theSet4.removeAll(new HashSet(firstList)): 5
Remark: I optimise little bit more the stuff by removing the class Cast and removing creation of object in loops.
[ March 11, 2008: Message edited by: Stephane Clinckart ]