Java Map Copy copyOf(Map src)

Here you can find the source of copyOf(Map src)

Description

copy Of

License

Open Source License

Declaration

public static <T, K> Map<T, K> copyOf(Map<T, K> src) 

Method Source Code

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

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

public class Main {
    public static <T, K> Map<T, K> copyOf(Map<T, K> src) {
        Map<T, K> dst = new HashMap<T, K>();
        copy(src, dst);/*from   w w  w  .java 2  s  .  com*/
        return dst;
    }

    public static <T, K> void copy(Map<T, K> src, Map<T, K> dst) {
        for (Entry<T, K> e : src.entrySet()) {
            dst.put(e.getKey(), e.getValue());
        }
    }
}

Related

  1. copyMap(Object object)
  2. copyMapButFailOnNull(Map entries)
  3. copyMapWithoutEmpties(Map original)
  4. copyOf( Map> map)
  5. copyOf(final Map map)
  6. copyOnWritePut(K k, V v, Map source)
  7. copyOptions(Map options)
  8. copyParameters(Map parameters)
  9. copyPropertiesToMap(Properties source, Map target)