Java Map Clone clone(Map aMap)

Here you can find the source of clone(Map aMap)

Description

Clones a map.

License

Open Source License

Declaration

public static Map clone(Map aMap) 

Method Source Code


//package com.java2s;
import java.util.*;

public class Main {
    /**/*from   www  .j  a  v a  2 s .  co m*/
     * Clones a map.
     */
    public static Map clone(Map aMap) {
        if (aMap instanceof HashMap)
            return (Map) ((HashMap) aMap).clone();
        if (aMap instanceof Hashtable)
            return (Map) ((Hashtable) aMap).clone();
        return aMap == null ? null : new HashMap(aMap);
    }
}

Related

  1. clone(Map from, Map to)
  2. clone(Map configurationValues)
  3. clone(Map map1)
  4. clone(Map origMap)