How would you initialise a static Map in Java?
Map
Method one: static initialiser Method two: instance initialiser (anonymous subclass) or some other m
Well... I like enums ;)
enum MyEnum { ONE (1, "one"), TWO (2, "two"), THREE (3, "three"); int value; String name; MyEnum(int value, String name) { this.value = value; this.name = name; } static final Map MAP = Stream.of( values() ) .collect( Collectors.toMap( e -> e.value, e -> e.name ) ); }