java 11 initialize map code example
Example 1: new hashmap java
Map myMap = new HashMap() {{
put("a", "b");
put("c", "d");
}};
Example 2: java 11 initialize map
Map emptyMap = Map.of();
Map singletonMap = Map.of("key1", "value");
Map map = Map.of("key1","value1", "key2", "value2");