How would you initialise a static Map in Java?
Map
Method one: static initialiser Method two: instance initialiser (anonymous subclass) or some other m
If you want unmodifiable map, finally java 9 added a cool factory method of to Map interface. Similar method is added to Set, List as well.
of
Map unmodifiableMap = Map.of("key1", "value1", "key2", "value2");