public class SynchronizedSortedBag<E> extends SynchronizedBag<E> implements SortedBag<E>
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.
lock
Modifier | Constructor | Description |
---|---|---|
protected |
SynchronizedSortedBag(Bag<E> bag,
java.lang.Object lock) |
Constructor that wraps (not copies).
|
protected |
SynchronizedSortedBag(SortedBag<E> bag) |
Constructor that wraps (not copies).
|
Modifier and Type | Method | Description |
---|---|---|
java.util.Comparator<? super E> |
comparator() |
Returns the comparator associated with this sorted set, or null
if it uses its elements' natural ordering.
|
E |
first() |
Returns the first (lowest) member.
|
protected SortedBag<E> |
getSortedBag() |
Gets the bag being decorated.
|
E |
last() |
Returns the last (highest) member.
|
static <E> SynchronizedSortedBag<E> |
synchronizedSortedBag(SortedBag<E> bag) |
Factory method to create a synchronized sorted bag.
|
add, add, containsAll, getCount, iterator, remove, remove, removeAll, retainAll, size, uniqueSet
addAll, clear, contains, equals, hashCode, isEmpty, parallelStream, removeIf, spliterator, stream, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, equals, getBag, getCount, hashCode, remove, synchronizedBag, uniqueSet
protected SynchronizedSortedBag(SortedBag<E> bag)
bag
- the bag to decorate, must not be nulljava.lang.NullPointerException
- if bag is nullpublic static <E> SynchronizedSortedBag<E> synchronizedSortedBag(SortedBag<E> bag)
E
- the type of the elements in the bagbag
- the bag to decorate, must not be nulljava.lang.NullPointerException
- if bag is nullprotected SortedBag<E> getSortedBag()
public E first()
SortedBag
public E last()
SortedBag
public java.util.Comparator<? super E> comparator()
SortedBag
comparator
in interface SortedBag<E>
Copyright © 2001-2019 - Apache Software Foundation