public static <K, V> Map.Entry<K, V> toEntry(K key, V value) {
return new AbstractMap.SimpleImmutableEntry<>(key, value);
}
public static <K, V, M> Map.Entry<M, V> mapKey(
Map.Entry<K, V> org, Function<K, M> mapper) {
return toEntry(mapper.apply(org.getKey()), org.getValue());
}
public static <K, V, M> Map.Entry<K, M> mapValue(
Map.Entry<K, V> org, Function<V, M> mapper) {
return toEntry(org.getKey(), mapper.apply(org.getValue()));
}