Commons-Collections contains implementations, enhancements and utilities that complement the Java Collections Framework.

The Apache Commons Collections Framework component adds a significant amount of enhancements to the standard JDK collections. These enhancements come in the form of new interfaces, new implementations and utility classes.

See also the {@code java.util} package for the standard Java collections.

# Main features

Commons-Collections defines a number of key interfaces:

Interfaces
Interface | Description
--- | ---
{@link org.apache.commons.collections4.Bag} | A new {@code Collection} subinterface that stores each object together with the number of occurrences. Methods are provided to get the number of occurrences, and to add and remove a certain number of that object.
{@link org.apache.commons.collections4.BidiMap} | A new {@code Map} subinterface that allows lookup from key to value and from value to key with equal ease.
{@link org.apache.commons.collections4.OrderedMap} | A new {@code Map} subinterface that is used when a map has an order, but is not sorted. Methods enable bidirectional iteration through the map.
{@link org.apache.commons.collections4.MapIterator} | A new {@code Iterator} subinterface specially designed for maps. This iterator avoids the need for entrySet iteration of a map, and is simpler to use.
{@link org.apache.commons.collections4.ResettableIterator} | A new {@code Iterator} subinterface that allows the iteration to be reset back to the start. Many iterators in this library have this functionality.
{@link org.apache.commons.collections4.Closure} {@link org.apache.commons.collections4.Predicate} {@link org.apache.commons.collections4.Transformer} {@link org.apache.commons.collections4.Factory} | A group of functor interfaces that provide plugin behavior to various collections and utilities.

In addition to the interfaces, there are many implementations. Consult each subpackage for full details of these.