public static < K > NumberMap < K , Integer > newIntegerMap ( ) { return new NumberMap < K , Integer > ( ) { @ Override public void add ( K key , Integer addend ) { put ( key , containsKey ( key ) ? ( get ( key ) + addend ) : addend ) ; } @ Override public void sub ( K key , Integer subtrahend ) { put ( key , ( containsKey ( key ) ? get ( key ) : 0 ) - subtrahend ) ; } } ; }
Creates a NumberMap for Integers .