Created
July 8, 2015 14:52
-
-
Save kirkbackus/e96ad7df18a80190e994 to your computer and use it in GitHub Desktop.
Revisions
-
kirkbackus created this gist
Jul 8, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ import java.util.Map; import java.util.HashMap; public class TestShallowCopy { public static void main(String[] args) { Map<String, Integer> a = new HashMap<String, Integer>(); a.put("TEST", 1); Map<String, Integer> b = new HashMap<String, Integer>(a); a.clear(); System.out.println("TEST: "+b.get("TEST")); System.out.println("A-size: "+a.size()); System.out.println("B-size: "+b.size()); } }