Package org.apache.commons.collections4.bag
This package contains implementations of the
Bag
and
SortedBag
interfaces.
A bag stores an object and a count of the number of occurrences of the object.
The following implementations are provided in the package:
- HashBag - implementation that uses a HashMap to store the data
- TreeBag - implementation that uses a TreeMap to store the data
The following decorators are provided in the package:
- Synchronized - synchronizes method access for multi-threaded environments
- Unmodifiable - ensures the bag cannot be altered
- Predicated - ensures that only elements that are valid according to a predicate can be added
- Transformed - transforms each element added to the bag
- Collection - ensures compliance with the java.util.Collection contract
-
Class Summary Class Description AbstractBagDecorator<E> Decorates anotherBag
to provide additional behaviour.AbstractMapBag<E> Abstract implementation of theBag
interface to simplify the creation of subclass implementations.AbstractMapBag.MutableInteger Mutable integer class for storing the data.AbstractSortedBagDecorator<E> Decorates anotherSortedBag
to provide additional behaviour.CollectionBag<E> Decorates anotherBag
to comply with the Collection contract.CollectionSortedBag<E> Decorates anotherSortedBag
to comply with the Collection contract.HashBag<E> ImplementsBag
, using aHashMap
to provide the data storage.PredicatedBag<E> Decorates anotherBag
to validate that additions match a specified predicate.PredicatedSortedBag<E> Decorates anotherSortedBag
to validate that additions match a specified predicate.SynchronizedBag<E> Decorates anotherBag
to synchronize its behaviour for a multi-threaded environment.SynchronizedSortedBag<E> Decorates anotherSortedBag
to synchronize its behaviour for a multi-threaded environment.TransformedBag<E> Decorates anotherBag
to transform objects that are added.TransformedSortedBag<E> Decorates anotherSortedBag
to transform objects that are added.TreeBag<E> UnmodifiableBag<E> Decorates anotherBag
to ensure it can't be altered.UnmodifiableSortedBag<E> Decorates anotherSortedBag
to ensure it can't be altered.