Sunday, December 9, 2007

Google Collections | new collections and collection-related goodness for Java 5.0

clipped from

The Google Collections Library 0.5 (ALPHA) is a suite of new collections and collection-related goodness for Java 5.0, brought to you by Google.

This library is a natural extension of the Java Collections Framework you already know and love.

  • BiMap. A Map that guarantees unique values, and supports an inverse view.
  • Multiset. A Collection that may contain duplicate values like a List, yet has order-independent equality like a Set. Often used to represent a histogram.
  • Multimap. Similar to Map, but may contain duplicate keys. Has subtypes SetMultimap and ListMultimap providing more specific behavior.
  • Comparators. Natural order, compound, null-friendly, ad-hoc . . .
  • Iterators and Iterables. Element-based equality, cycle, concat, partition, filter with predicate, transform with function . . .
  • Lists, Sets and Maps. A plethora of convenient factory methods and much more.
  • PrimitiveArrays: "boxing"/"unboxing" of primitive arrays