If you need the key-value pairs, then don't iterate over the keys and get the values. It's more efficient to iterate over the entries of the map, so that you don't have to do a lookup in the map for each key. Each entry is a key-value pair. For example:
About Campbell's remark: Class Vector is a legacy collection class. It has been replaced by ArrayList since
Java 1.2. There's no good reason anymore to use the old class Vector. Instead of StringTokenizer, you can use the newer and more convenient class Scanner.