boolean
|
add(Object object, int nCopies)
Adds a new element to the bag, incrementing its count in the map.
|
boolean
|
add(Object object)
Adds a new element to the bag, incrementing its count in the underlying map.
|
boolean
|
addAll(Collection coll)
Invokes add(Object) for each element in the given collection.
|
void
|
clear()
Clears the bag by clearing the underlying map.
|
boolean
|
contains(Object object)
Determines if the bag contains the given element by checking if the
underlying map contains the element as a key.
|
boolean
|
containsAll(Collection coll)
Determines if the bag contains the given elements.
|
void
|
doReadObject(Map map, ObjectInputStream in)
Read the map in using a custom routine.
|
void
|
doWriteObject(ObjectOutputStream out)
Write the map out using a custom routine.
|
boolean
|
equals(Object object)
Compares this Bag to another.
|
int
|
getCount(Object object)
Returns the number of occurrence of the given element in this bag
by looking up its count in the underlying map.
|
Map
|
getMap()
Utility method for implementations to access the map that backs
this bag.
|
int
|
hashCode()
Gets a hash code for the Bag compatible with the definition of equals.
|
boolean
|
isEmpty()
Returns true if the underlying map is empty.
|
Iterator
|
iterator()
Gets an iterator over the bag elements.
|
boolean
|
remove(Object object, int nCopies)
Removes a specified number of copies of an object from the bag.
|
boolean
|
remove(Object object)
Removes all copies of the specified object from the bag.
|
boolean
|
removeAll(Collection coll)
Removes objects from the bag according to their count in the specified collection.
|
boolean
|
retainAll(Collection coll)
Remove any members of the bag that are not in the given
bag, respecting cardinality.
|
int
|
size()
Returns the number of elements in this bag.
|
Object[]
|
toArray()
Returns an array of all of this bag's elements.
|
Object[]
|
toArray(Object[] array)
Returns an array of all of this bag's elements.
|
String
|
toString()
Implement a toString() method suitable for debugging.
|
Set
|
uniqueSet()
Returns an unmodifiable view of the underlying map's key set.
|