Here you can find the source of clone(Map
Parameter | Description |
---|---|
origMap | a parameter |
public static <K, V> HashMap<K, V> clone(Map<K, V> origMap)
//package com.java2s; //License from project: Open Source License import java.util.HashMap; import java.util.Map; public class Main { /**/* w ww.j a va2s . co m*/ * 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; } }