Here you can find the source of copyOf( Map
public static <KEY_1, KEY_2, VALUE> Map<KEY_1, Map<KEY_2, VALUE>> copyOf( Map<KEY_1, ? extends Map<KEY_2, VALUE>> map)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.util.HashMap; import java.util.Map; public class Main { /**//from www . ja v a 2s.c om * Returns a copy of the Map of Maps parameter. */ public static <KEY_1, KEY_2, VALUE> Map<KEY_1, Map<KEY_2, VALUE>> copyOf( Map<KEY_1, ? extends Map<KEY_2, VALUE>> map) { Map<KEY_1, Map<KEY_2, VALUE>> result = new HashMap<>(); for (Map.Entry<KEY_1, ? extends Map<KEY_2, VALUE>> entry : map .entrySet()) { result.put(entry.getKey(), new HashMap<>(entry.getValue())); } return result; } }