public static < K , V > Map < K , V > map ( Object ... keysAndValues ) { if ( keysAndValues . length % 2 != 0 ) { throw new IllegalArgumentException ( "number of arguments must be even" ) ; } Map < K , V > map = new HashMap < K , V > ( Math . max ( keysAndValues . length , 16 ) ) ; for ( int i = 0 ; i < keysAndValues . length ; ) { map . put ( ( K ) keysAndValues [ i ++ ] , ( V ) keysAndValues [ i ++ ] ) ; } return map ; }
Create a map from keys and values .