Java Map Invert inverse(Map m, Map newMap)

Here you can find the source of inverse(Map m, Map newMap)

Description

inverse

License

Open Source License

Declaration

public static <K, V> Map<V, K> inverse(Map<K, V> m, Map<V, K> newMap) 

Method Source Code

//package com.java2s;
// The MIT License (MIT)

import java.util.Map;
import java.util.Map.Entry;

public class Main {
    public static <K, V> Map<V, K> inverse(Map<K, V> m, Map<V, K> newMap) {
        for (Entry<K, V> entry : m.entrySet()) {
            newMap.put(entry.getValue(), entry.getKey());
        }/*  www . j  av  a  2 s .  c om*/
        return newMap;
    }
}

Related

  1. inverse(Map map)
  2. inverse(Map map)
  3. inverseGet(Map map, Object value)
  4. invert(Map map)