RSS Feed for This PostCurrent Article

Open Source Java Collections Library

There are times that you may want to use collections library other that the one provided by Java natively. Here are some alternative.

Commons-Collections seek to build upon the JDK classes by providing new interfaces, implementations and utilities. There are many features, including:

  • Bag interface for collections that have a number of copies of each object
  • Buffer interface for collections that have a well defined removal order, like FIFOs
  • BidiMap interface for maps that can be looked up from value to key as well and key to value
  • MapIterator interface to provide simple and quick iteration over maps
  • Type checking decorators to ensure that only instances of a certain type can be added
  • Transforming decorators that alter each object as it is added to the collection
  • Composite collections that make multiple collections look like one
  • Ordered maps and sets that retain the order elements are added in, including an LRU based map
  • Identity map that compares objects based on their identity (==) instead of the equals method
  • Reference map that allows keys and/or values to be garbage collected under close control
  • Many comparator implementations
  • Many iterator implementations
  • Adapter classes from array and enumerations to collections
  • Utilities to test or create typical set-theory properties of collections such as union, intersection, and closure

 

Trove library provides high speed regular and primitive collections for Java.
The GNU Trove library has two objectives:

  • Provide “free” (as in “free speech” and “free beer”), fast, lightweight implementations of the java.util Collections API. These implementations are designed to be pluggable replacements for their JDK equivalents.
  • Provide primitive collections with similar APIs to the above. This gap in the JDK is often addressed by using the “wrapper” classes (java.lang.Integer, java.lang.Float, etc.) with Object-based collections. For most applications, however, collections which store primitives directly will require less space and yield significant performance gains.

 

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

The major new types are:

  • 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.

 

fastutil extends the Java™ Collections Framework by providing type-specific maps, sets, lists and queues with a small memory footprint and fast access and insertion; it also includes a fast I/O API for binary and text files. I


Trackback URL


Sorry, comments for this entry are closed at this time.