Answers for "java hashmap loop keys"

31

java iterate through hashmap

for (Map.Entry<String, String> entry : yourHashMap.entrySet()) {
	System.out.println(entry.getKey() + " = " + entry.getValue());
}
Posted by: Guest on April-13-2020
1

java iterate through map

for (Map.Entry<String, Object> entry : map.entrySet()) {
    String key = entry.getKey();
    Object value = entry.getValue();
    // ...
}
Posted by: Guest on May-25-2020
2

how to iterate hashmap java

Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
    System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
}
Posted by: Guest on May-21-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language