public static < T extends Map . Entry < String , String > > Map < String , String > toMap ( Collection < T > from ) { HashMap < String , String > map = new HashMap < String , String > ( ) ; if ( from != null ) { for ( Map . Entry < String , String > entry : from ) { String key = entry . getKey ( ) ; if ( ! map . containsKey ( key ) ) { map . put ( key , entry . getValue ( ) ) ; } } } return map ; }
Construct a Map containing a copy of the given parameters . If several parameters have the same name the Map will contain the first value only .