user840930 user840930 - 1 year ago 82
Java Question

How can I retrieve values and keys from a HashMap in Java 8?

I tried to use an Iterator but gives me an int. Not sure what to do with an int. How can I get the keys and values?

Answer Source
for (final Map.Entry<String, Object> entry : hashmap.entrySet()) {
       final String key = entry.getKey();
       System.out.println("Key:" + key);
       Object obj = entry.getValue();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download