Traversing the Map (HashMap) in Java

/ Published in: Java
Save to your folder(s)

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

Copy this code and paste it in your HTML
  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


RSS Icon Subscribe to comments

You need to login to post a comment.