public static < KType , VType > KTypeVTypeHashMap < KType , VType > from ( KType [ ] keys , VType [ ] values ) { if ( keys . length != values . length ) { throw new IllegalArgumentException ( "Arrays of keys and values must have an identical length." ) ; } KTypeVTypeHashMap < KType , VType > map = new KTypeVTypeHashMap <> ( keys . length ) ; for ( int i = 0 ; i < keys . length ; i ++ ) { map . put ( keys [ i ] , values [ i ] ) ; } return map ; }
Creates a hash map from two index - aligned arrays of key - value pairs .