I’ve been out of the loop on straight Java programming for a while, so this is probably obvious to a lot of people, and has been for a long time. But on the off chance that I’m not the only other idiot out there, I’ll post this.

The old way of instantiating a List in Java was like this:

List strings = Arrays.asList(new String[]{"foo","bar"});

In Java 5, templates were introduced, so I had to change to doing this:

List<String> strings = Arrays.asList(new String[]{"foo","bar"});

It just occurred to me that with variable-length methods, I can simply call asList like this:

List<String> strings = Arrays.asList("foo","bar");