There is no literal to initialize the map in this way. But you can use an anonymous class created in place:
map.put(getValuesTypes.FUT(), new HashMap<Double, String>() {{ put(1.0, "A"); put(2.0, "B"); }});
although this is not recommended. I would suggest using Guava ImmutableMap :
map.put(getValuesTypes.FUT(), ImmutableMap.<Double, String>of(1.0, "A", 2.0, "B"));
If the number of pairs is greater than 5 , you should use their builder :
map.put(getValuesTypes.FUT(), ImmutableMap.<Double, String>builder().put(1.0, "A").build());
source share