Java - How to deep copy HashSet, HashMap
790 ワード
Deep copy HashSet
or
Deep copy HashMap
or
Anyway, Good luck, Richardo! -- 09/27/2016
HashSet set = new HashSet();
HashSet set2 = new HashSet();
set2.addAll(set);
or
HashSet set = new HashSet();
HashSet set2 = new HashSet(set);
Deep copy HashMap
HashMap map = new HashMap<>();
HashMap map2 = new HashMap<>();
map2.putAll(map);
or
HashMap map = new HashMap<>();
HashMap map2 = new HashMap<>(map);
Anyway, Good luck, Richardo! -- 09/27/2016