public static < K , V > SolidMap < K , V > map ( K key , V value , Object ... pairs ) { if ( pairs . length % 2 != 0 ) throw new IllegalArgumentException ( "SolidMap.map(...) takes even number of arguments" ) ; LinkedHashMap < K , V > m = new LinkedHashMap <> ( ) ; m . put ( key , value ) ; for ( int i = 0 ; i < pairs . length ; i += 2 ) m . put ( ( K ) pairs [ i ] , ( V ) pairs [ i + 1 ] ) ; return new SolidMap <> ( m ) ; }
Creates a map using interleaving keys and values .