E
- the type of elements in this bagpublic 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 and Description |
---|---|
protected |
SynchronizedSortedBag(Bag<E> bag,
Object lock)
Constructor that wraps (not copies).
|
protected |
SynchronizedSortedBag(SortedBag<E> bag)
Constructor that wraps (not copies).
|
Modifier and Type | Method and Description |
---|---|
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, equals, getBag, getCount, hashCode, remove, synchronizedBag, uniqueSet
add, addAll, clear, contains, containsAll, decorated, isEmpty, iterator, remove, removeAll, removeIf, retainAll, size, synchronizedCollection, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, add, containsAll, getCount, iterator, remove, remove, removeAll, retainAll, size, uniqueSet
addAll, clear, contains, equals, hashCode, isEmpty, parallelStream, removeIf, spliterator, stream, toArray, toArray
protected SynchronizedSortedBag(SortedBag<E> bag)
bag
- the bag to decorate, must not be nullNullPointerException
- if bag is nullprotected SynchronizedSortedBag(Bag<E> bag, Object lock)
bag
- the bag to decorate, must not be nulllock
- the lock to use, must not be nullNullPointerException
- if bag or lock 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 nullNullPointerException
- if bag is nullprotected SortedBag<E> getSortedBag()
public E first()
SortedBag
public E last()
SortedBag
public Comparator<? super E> comparator()
SortedBag
comparator
in interface SortedBag<E>
Copyright © 2001–2019 The Apache Software Foundation. All rights reserved.