code: public static <T, K> HashMap<K, T> toHashMap(Collection<T> entities,
  			Function<T, K> keyMapper) {
  		return toMap(entities, keyMapper, HashMap<K, T>::new);
  	}
docs: Convert a collection to HashMap, The key is decided by keyMapper, value
  is the object in collection
  
  @param entities
  @param keyMapper
  @return