Well a HashMap is a Map, which is to say that a 'key' has a corrosponding 'value', like a function. For instance, you could map football players' positions to names, so that Wide Reciever would map to Terrel Owens, and Quarterback would map to Donnovan McNabb. (E.A.G.L.E.S. EAGLES).
So:
When I say
HashMap players=new HashMap();, I create an empty hash map.
I can then say
players.put("Wide Reciever","Terrel Owens"); I have mapped "Wide Reciever" to "Terrel Owens"
players.put("Quarterback","Donnovan McNabb"); I have mapped "Quarterback" to "Donnovan McNabb".
I can now say:
String quarterback=map.get("Quarterback"); and quarterback will be set to "Donnovan McNabb".
Dig?
Note that any Object can be a key, and any Object can be a value, so you can map "D-line" to an ArrayList with the whole Defensive line.
(Picky people will point out that come java version 5, you don't even need these to be Objects. To them, I stick my tounge out and say, "5 ain't released yet!")
Maybe someone else will take up the topic of iterators now.
[ December 06, 2004: Message edited by: Nick George ]