Arrays.asList("Rod", "Jane", "Freddy"); - Dion points out the shortcut to creating a List. One of the libraries I always have handy does this for Maps and Sets too, so you can do:
Map m = StructUtil.map( new String[] { "foo", "bar", "baz", "blargle" } );
Not as nice as the Rhino or Groovy (or Perl!) versions, but still handy. (Java's lack of shortcuts for stuff like this is really frustrating, although the varargs in 1.5 should make this simpler.) If you implement this yourself I recommend using LinkedHashMap as an implementation so you get the keys back in the same order you inserted them.
Posted from cwinters.com; read original