Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.HashMap;

import java.util.Map;

public class Main {
    /**
     * returns a new HashMap containing a shallow clone of the
     * original map.
     * @param origMap
     * @return
     */
    public static <K, V> HashMap<K, V> clone(Map<K, V> origMap) {

        HashMap<K, V> newMap = new HashMap<K, V>();
        if (origMap != null && origMap.size() > 0) {
            newMap.putAll(origMap);
        }
        return newMap;
    }
}