Java Map Copy copyOf( Map> map)

Here you can find the source of copyOf( Map> map)

Description

Returns a copy of the Map of Maps parameter.

License

Open Source License

Declaration

public static <KEY_1, KEY_2, VALUE> Map<KEY_1, Map<KEY_2, VALUE>> copyOf(
        Map<KEY_1, ? extends Map<KEY_2, VALUE>> map) 

Method Source Code

//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;
    }
}

Related

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