public static < K1 , V1 , K2 , V2 > MutableMap < K2 , V2 > collect ( Map < K1 , V1 > map , final Function < ? super K1 , ? extends K2 > keyFunction , final Function < ? super V1 , ? extends V2 > valueFunction , Map < K2 , V2 > target ) { return MapIterate . collect ( map , new Function2 < K1 , V1 , Pair < K2 , V2 > > ( ) { public Pair < K2 , V2 > value ( K1 key , V1 value ) { return Tuples . pair ( keyFunction . valueOf ( key ) , valueFunction . valueOf ( value ) ) ; } } , MapAdapter . adapt ( target ) ) ; }
For each key - value entry of a map applies a function to each and adds the transformed entry to the target Map .