// initialising a HashMap
private static final Map<String,String> myMap
                = new HashMap<String,String> ( 149 /* capacity */, 0.75f /* loadfactor */ );
static {
 myMap.add( "apple", "green" );
 myMap.add( "plum", "purple" );
 }

// The technique works similarly for local HashMaps
private void doSomething()
  {
  final Map<String,String> myMap
                = new HashMap<String,String> ( 149 /* capacity */, 0.75f /* loadfactor */ );
    {
    myMap.add( "apple", "green" );
    myMap.add( "plum", "purple" );
    }
  ...
  }