Here you can find the source of copyOf(Map
public static <T, K> Map<T, K> copyOf(Map<T, K> src)
//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()); } } }