Created
February 6, 2013 19:44
-
-
Save cancerberoSgx/4725187 to your computer and use it in GitHub Desktop.
Collections.copy() do not seem to work. The following fails at least with two implementations: LinkedList and ArrayList, in production mode :
This file contains 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 characters
List<String> l1 = new LinkedList<String>(); | |
List<String> l2 = new LinkedList<String>(); | |
// List<String> l1 = new ArrayList<String>(); | |
// List<String> l2 = new ArrayList<String>(); | |
// copy empty list | |
Collections.copy(l2, l1); | |
l1.add("A"); | |
l2.add("B"); | |
Collections.copy(l2, l1); | |
if(!l2.get(0).equals("A")) { | |
Window.alert("error"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment