1Map<String, String> emptyMap = Map.of();
2Map<String, String> singletonMap = Map.of("key1", "value");
3Map<String, String> map = Map.of("key1","value1", "key2", "value2");
4
1Map<String, Integer> map = Stream.of(
2 new AbstractMap.SimpleEntry<>("idea", 1),
3 new AbstractMap.SimpleEntry<>("mobile", 2))
4 .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
1Map<String, Integer> map = Stream.of(
2 new AbstractMap.SimpleImmutableEntry<>("idea", 1),
3 new AbstractMap.SimpleImmutableEntry<>("mobile", 2))
4 .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));