java 8 loop in map
Map<String, Integer> items = new HashMap<>();
items.put("A", 10);
items.put("B", 20);
items.put("C", 30);
items.put("D", 40);
items.put("E", 50);
items.put("F", 60);
items.forEach((k,v)->System.out.println("Item : " + k + " Count : " + v));
items.forEach((k,v)->{
System.out.println("Item : " + k + " Count : " + v);
if("E".equals(k)){
System.out.println("Hello E");
}
});public void iterateUsingStreamAPI(Map<String, Integer> map) {
map.entrySet().stream()
// ...
.forEach(e -> System.out.println(e.getKey() + ":" + e.getValue()));
}
Also in Java:
- java xml element get attribute value
- org.mapstruct maven dependency
- print arraylist java
- faire un timer en java
- java hahmap
- index of an array procesing
- java syntax
- java find duplicates in array
- Error executing Maven. java.io.FileNotFoundException: The specified user settings file does not exist: /etc/java-8-openjdk
- .length array java
- java print treemap
- java question mark operator
- objectoutputstream exemple
- java print type of object
- java random between two strings
- what is a float java
- java string replace character at position
- bukkit java set leather armor color from hex
- java replace element in list
- math minimum java
- determine if a given binary tree is a valid bst
- import
- how to take binary input in java
- bukkit java get max players