code: public static <K, V, E> Map<K, V> transformMapValue(Map<K, E> input, Function<E, V> f) {
        // This screams for a map function! Gimme functional programming pleasee...
        if (input.isEmpty()) return Collections.emptyMap();
        if (input.size() == 1) {
           Map.Entry<K, E> single = input.entrySet().iterator().next();
           return singletonMap(single.getKey(), f.transform(single.getValue()));
        } else {
           Map<K, V> copy = new HashMap<>(input.size());
           for (Map.Entry<K, E> entry : input.entrySet())
              copy.put(entry.getKey(), f.transform(entry.getValue()));
           return unmodifiableMap(copy);
        }
     }
docs: Given a map of well known key/value types, it makes a shallow copy of it
  while at the same time transforming it's value type to a desired output
  type. The transformation of the value type is done using a given a
  function.
  
  @param input contains the input key/value pair map
  @param f function instance to use to transform the value part of the map
  @param <K> input map's key type
  @param <V> desired output type of the map's value
  @param <E> input map's value type
  @return a shallow copy of the input Map with all its values transformed.