Here you can find the source of copy(HashMap
public static HashMap<Byte, String> copy(HashMap<Byte, String> oldHashMap)
//package com.java2s; //License from project: Open Source License import java.util.HashMap; public class Main { public static HashMap<Byte, String> copy(HashMap<Byte, String> oldHashMap) { HashMap<Byte, String> newHashMap = new HashMap<Byte, String>(); for (Byte b : oldHashMap.keySet()) { String str = oldHashMap.get(b); newHashMap.put(b, str);//w w w. j a va 2 s . c o m } return newHashMap; } }