Hacker News new | ask | show | jobs
by Macha 5059 days ago
> List<String> myList = Arrays.asList("one", "two", "three");

This is often not good enough, as Arrays.asList returns some internal immutable List type. If you then tried to do something like myList.add("four"); you'd get an exception.

What you'd actually need to do is something more like:

> List<String> myList = new ArrayList<String>(Arrays.asList("one", "two", "three"));

Compare that to more dynamic languages, where that example would be:

> myList = ["one", "two", "three"]

Yes, it's a trivial example, but it's something many programs involve all over the place, and the boilerplate adds up a tedious task.