public static < T , K > Function < T , Void > addTo ( final Map < K , T > map , final Function < ? super T , ? extends K > keyMaker ) { return new Function < T , Void > ( ) { public Void apply ( T arg ) { map . put ( keyMaker . apply ( arg ) , arg ) ; return null ; } } ; }
Returns a function that adds its argument to a map using a supplied function to determine the key .