Posted By

Uzbekjon on 12/05/08


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Traversing the Map (HashMap) in Java

 / Published in: Java


How to traverse a hash map in java, similar to PHP's foreach.

  1. //HashMap<Key, Value> map = new HashMap<Key, Value>();
  2. for (Key key : map.keySet()) {
  3. Value value = map.get(key);
  4. }

Report this snippet  

You need to login to post a comment.