File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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);

[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
I agree. Here's the link:
subject: Iterating through a hash map
Similar Threads
Sorting Maps
Storing ActionForm&action class-WHERE?
Doubt in Hash Map and Hash Table
need help copying hashmaps
Load Testing Using Jmeter