Skip to content

Instantly share code, notes, and snippets.

@njlr
Created September 7, 2017 10:38
Show Gist options
  • Save njlr/167829b767336836085c3f0ea53b9d34 to your computer and use it in GitHub Desktop.
Save njlr/167829b767336836085c3f0ea53b9d34 to your computer and use it in GitHub Desktop.
final List<String> xs = new ArrayList<>();
// We can modify xs internally
xs.add("a");
xs.add("b");
xs.add("c");
// ... but we cannot change where it points to!
xs = new ArrayList<>(); // Will not compile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment