java.lang.Object | +--org.apache.commons.collections.collection.SynchronizedCollection | +--org.apache.commons.collections.bag.SynchronizedBagAll Implemented Interfaces:
SynchronizedBag(Bag bag) Constructor that wraps (not copies). |
SynchronizedBag(Bag bag, Object lock) Constructor that wraps (not copies). |
boolean | add(Object object, int count) |
static Bag | Factory method to create a synchronized bag. |
getBag() | |
int | getCount(Object object) |
boolean | remove(Object object, int count) |
Set |
protected SynchronizedBag(Bag bag, Object lock)
- if bag is nullprotected SynchronizedBag(Bag bag)
- if bag is nullpublic boolean add(Object object, int count)
public static Bag decorate(Bag bag)
- if bag is nullprotected Bag getBag()
public int getCount(Object object)
public boolean remove(Object object, int count)
public Set uniqueSet()
Bag
to synchronize its behaviour for a multi-threaded environment. Methods are synchronized, then forwarded to the decorated bag. Iterators must be separately synchronized around the loop.