HashMap<String,Integer> map= new HashMap<String,Integer>();
map.put("first",1);
map.put("second",2);
map.put("third",3);
HashMap<String,Integer> map2= new HashMap<String,Integer>();
map2= map.clone();
我的问题是如何将项目从地图转移到地图2?我的代码是否正确?如何将内容从以前的散列表转换为新的散列表?
哇,不知道可能是那么短。谢谢 – ThisGuy
在完美的世界中,Map map2 = ...' - 最好尽可能使用接口。 –