@ SafeVarargs public static < T > Map < T , T > createMap ( T ... _args ) { Map < T , T > map = new HashMap <> ( ) ; if ( _args != null ) { if ( _args . length % 2 != 0 ) { throw new IllegalArgumentException ( "Even number of parameters required to create map: " + Arrays . toString ( _args ) ) ; } for ( int i = 0 ; i < _args . length ; ) { map . put ( _args [ i ] , _args [ i + 1 ] ) ; i += 2 ; } } return map ; }
Creates a map from the even - sized parameter array .