org.apache.commons.collections.bag
public class SynchronizedSortedBag extends SynchronizedBag implements SortedBag
SortedBag 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.
This class is Serializable from Commons Collections 3.1.
Since: Commons Collections 3.0
Version: $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $
| Constructor Summary | |
|---|---|
| protected | SynchronizedSortedBag(SortedBag bag)
Constructor that wraps (not copies).
|
| protected | SynchronizedSortedBag(Bag bag, Object lock)
Constructor that wraps (not copies).
|
| Method Summary | |
|---|---|
| Comparator | comparator() |
| static SortedBag | decorate(SortedBag bag)
Factory method to create a synchronized sorted bag.
|
| Object | first() |
| protected SortedBag | getSortedBag()
Gets the bag being decorated.
|
| Object | last() |
Parameters: bag the bag to decorate, must not be null
Throws: IllegalArgumentException if bag is null
Parameters: bag the bag to decorate, must not be null lock the lock to use, must not be null
Throws: IllegalArgumentException if bag is null
Parameters: bag the bag to decorate, must not be null
Returns: a new synchronized SortedBag
Throws: IllegalArgumentException if bag is null
Returns: the decorated bag