Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import java.util.HashMap;

import java.util.Map;

public class Main {
    /**
     * 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;
    }
}