Java Map Invert invertMap(Map map)

Here you can find the source of invertMap(Map map)

Description

invert Map

License

Open Source License

Declaration

public static <V, K> Map<V, K> invertMap(Map<K, V> map) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.HashMap;

import java.util.Map;

public class Main {
    public static <V, K> Map<V, K> invertMap(Map<K, V> map) {
        Map<V, K> inverted = new HashMap<V, K>();
        for (Map.Entry<K, V> entry : map.entrySet()) {
            inverted.put(entry.getValue(), entry.getKey());
        }//from   w ww. j av  a2 s .co m
        return inverted;
    }
}

Related

  1. invertMap(final Map map)
  2. invertMap(Map map)
  3. invertMap(Map map)
  4. invertMap(Map map)
  5. invertMap(Map map)
  6. invertStringMap(Map input)