Creates map from array using key function
Function to generate key
Array to index
Map of values by key
Creates map from array using key function