This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Read the documentation for the map interface, if you had you would realise that. 1 HashMap is an implementation of Map i.e an object that maps keys to values 2 A map cannot contain duplicate keys 3 each key can map to at most one value.
Joined: Dec 01, 2003
Well, you seem to already know it. You just need to realize that Set implements Collection, and that there are HashMap methods for getting the set of keys and the collection of values. Just make sure that your keys and values are Comparable or that you have a Comparator!