September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,15 +1,15 @@
Map<String, Integer> myDict = new HashMap<>();
myDict.put("hello", 1);
myDict.put("world", 2);
myDict.put("!", 3);
Map<String, Integer> map = new HashMap<>();
map.put("hello", 1);
map.put("world", 2);
map.put("!", 3);
// iterating over key-value pairs:
myDict.forEach((k, v) -> {
map.forEach((k, v) -> {
System.out.printf("key = %s, value = %s%n", k, v);
});
// iterating over keys:
myDict.keySet().forEach(k -> System.out.printf("key = %s%n", k));
map.keySet().forEach(k -> System.out.printf("key = %s%n", k));
// iterating over values:
myDict.values().forEach(v -> System.out.printf("value = %s%n", v));
map.values().forEach(v -> System.out.printf("value = %s%n", v));