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 getCount(Object) on a would return 2, while
calling uniqueSet() would return {a, b, c}.
NOTE: This interface violates the 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.
Suppose you have a Bag that contains
{a, a, b, c}. Calling getCount(Object) onawould return 2, while calling uniqueSet() would return{a, b, c}.NOTE: This interface violates the 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 aCollection.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.