Defines a collection that counts the number of times an object appears in the collection.
Suppose you have a Bag that contains
{a, a, b, c}
. Calling {@link #getCount(Object)} on
a
would return 2, whilecalling {@link #uniqueSet()} would return
{a, b, c}
.
NOTE: This interface violates the {@link Collection} contract.The behavior specified in many of these methods is
not the same as the behavior specified by
Collection
. The noncompliant methods are clearly marked with "(Violation)". Exercise caution when using a bag as a
Collection
.
This violation resulted from the original specification of this interface. In an ideal world, the interface would be changed to fix the problems, however it has been decided to maintain backwards compatibility instead.
@author Chuck Burdick
@author Matt Hall, John Watkinson, Stephen Colebourne
@version $Revision: 1.1 $ $Date: 2005/10/11 17:05:19 $
@since Commons Collections 2.0