Java HashMap Copy copyMap(HashMap map)

Here you can find the source of copyMap(HashMap map)

Description

copy Map

License

Open Source License

Declaration

public static HashMap copyMap(HashMap map) 

Method Source Code

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

import java.util.HashMap;

public class Main {
    public static HashMap copyMap(HashMap map) {
        HashMap<Object, Object> newmap = new HashMap<>(10);

        for (Object key : map.keySet()) {
            newmap.put(key, map.get(key));
        }/*from  ww  w  .  jav a  2  s  . c  o m*/

        return newmap;
    }
}

Related

  1. copy(HashMap oldHashMap)
  2. copyDirective(HashMap directives, StringBuilder sb, String directive)
  3. copyHashMap(final HashMap map)
  4. copyHashWords(HashMap> ohwords, HashMap> nhwords, int start, int end, int nstart)
  5. copyItem(HashMap to, HashMap from, String key)
  6. copyParam(HashMap from, HashMap to, String key)