public static <T1, T2> Map<T2, T1> transformAndMap(Collection<T1> from,
      Transformer<T1, T2> transformer) {
    Map<T2, T1> map = new HashMap<>();
    for (T1 instance : from) {
      map.put(transformer.transform(instance), instance);
    }

    return map;
  }
Transforms a collection of one data type into another and returns a map using the transformed
type as the key and the original type as the value.

@param from a collection of data to be transformed.
@param transformer transforms the data.

@return a Map of transformed values that are keys to the original values.
geode-core/src/main/java/org/apache/geode/internal/util/TransformUtils.java