Skip to content

Instantly share code, notes, and snippets.

@cancerberoSgx
Created February 6, 2013 19:44
Show Gist options
  • Save cancerberoSgx/4725187 to your computer and use it in GitHub Desktop.
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 :
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