java.lang.Object | +--org.apache.commons.collections.collection.AbstractCollectionDecorator | +--org.apache.commons.collections.collection.PredicatedCollection | +--org.apache.commons.collections.bag.PredicatedBagAll Implemented Interfaces:
PredicatedBag(Bag bag, Predicate predicate) Constructor that wraps (not copies). |
boolean | add(Object object, int count) |
static Bag | decorate(Bag bag, Predicate predicate) Factory method to create a predicated (validating) bag. |
getBag() Gets the decorated bag. | |
int | getCount(Object object) |
boolean | remove(Object object, int count) |
Set |
protected PredicatedBag(Bag bag, Predicate predicate)
- if bag or predicate is null
- if the bag contains invalid elementspublic boolean add(Object object, int count)
public static Bag decorate(Bag bag, Predicate predicate)
- if bag or predicate is null
- if the bag contains invalid elementsprotected Bag getBag()
public int getCount(Object object)
public boolean remove(Object object, int count)
public Set uniqueSet()
Bag
to validate that additions match a specified predicate. If an object cannot be added to the list, an IllegalArgumentException is thrown.