3 ms·
I personally prefer Guava's immutable collections: List<String> fruits = ImmutableList.of("apple", "orange", "pear"); It also works for sets and maps:
by eneveu 15y ago
I personally prefer Guava's immutable collections:
List<String> fruits = ImmutableList.of("apple", "orange", "pear");
It also works for sets and maps:
Set<String> fruits = ImmutableSet.of("apple", "orange", "pear");
Map<String, Integer> fruitCounts = ImmutableMap.of("apple", 3, "orange", 2, "pear", 6);
http://code.google.com/p/guava-libraries/wiki/ImmutableCollectionsExplained http://code.google.com/p/guava-libraries/wiki/ImmutableColle...