|
|
|
|
|
by rtg
5437 days ago
|
|
If you use the Google library [1], this becomes a bit more convenient that the built-in Java way: List<String> people = ImmutableList.of("Frank", "Mary", "Bob");
There's also ImmutableSet and many other goodies, to say the least. For instantiation of these generic types, you can do: List<String> people = Lists.newArrayList();
Map<String,Integer> scores = Maps.newHashMap();
and so on.[1] http://code.google.com/p/guava-libraries/ |
|