public static < T , K > MutableMap < K , T > toMap ( Iterable < T > iterable , Function < ? super T , ? extends K > keyFunction ) { MutableMap < K , T > map = UnifiedMap . newMap ( ) ; Iterate . forEach ( iterable , new MapCollectProcedure < T , K , T > ( map , keyFunction ) ) ; return map ; }
Iterate over the specified collection applying the specified Function to each element to calculate a key and return the results as a Map .