Java Utililty Methods HashMap Reverse

List of utility methods to do HashMap Reverse

Description

The list of methods to do HashMap Reverse are organized into topic(s).

Method

HashMapreverseHashMap(HashMap map)
reverse Hash Map
HashMap<B, A> reverseMap = new HashMap<B, A>();
for (A a : map.keySet()) {
    B b = map.get(a);
    reverseMap.put(b, a);
return reverseMap;
MapreverseHashMap(Map map)
reverse Hash Map
Map<U, T> ret = new HashMap<>(map.size());
for (Entry<? extends T, ? extends U> entr : map.entrySet()) {
    ret.put(entr.getValue(), entr.getKey());
return ret;