wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Iterating through a hash map Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Iterating through a hash map" Watch "Iterating through a hash map" New topic

Iterating through a hash map

Bart Wilson

Joined: Aug 01, 2001
Posts: 17
I need help on how to proceed this. I need to iterate through a hash map.
Bart Wilson

Joined: Aug 01, 2001
Posts: 17
This is what I got so far, am I on the right track?
Set entries = someObject.getItems().entrySet();
Iterator iterator = entries.iterator();
while (iterator.hasNext())
Map.Entry entry = (Map.Entry)iterator.next();

[This message has been edited by Bart Wilson (edited November 13, 2001).]
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
The following iterates through the keys in a map
Set Keys = yourMap.keySet()
Iterator it = Keys.iterator()
do whatever...

SCJP for the Java� 2 Platform

So much trouble in the world -- Bob Marley
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Iterating through a hash map