You are probably using JDK 1.5 and that is because of generics, a nice feature incorporated in Collections.
Download a free book on Generics by Maurice Naftalin and Philip Wadler in
http://java.net.
Now you can do it like this:
I would like to take this opportunity to tell you that Vector, Stack and Hashtable are considered now legacy collections.
Now we typically use ArrayList, LinkedList, HashMap, and other collections part of the JCF (
Java Collections Framework).