rewrite
rewrite copied to clipboard
prefer `map.entrySet()` over manual iteration of the `keySet` and manual access to the values
Map<String,String> map = new HashMap<>();
map.put("hello","world");
for (String key : map.keySet()){
String value = map.get(key);
System.out.println("Key " + key + " value " + value);
}
Map<String,String> map = new HashMap<>();
map.put("hello","world");
for (Map.Entry<String, String> entry : map.entrySet()){
System.out.println("Key " + entry.getKey() + " value " + entry.getValue());
}