E - A class implementing Comparable or able to be
compared by a provided comparator.@InterfaceAudience.Private public class SortedCopyOnWriteSet<E> extends Object implements SortedSet<E>
SortedSet implementation that uses an internal
TreeSet to provide ordering. All mutation operations
create a new copy of the TreeSet instance, so are very
expensive. This class is only intended for use on small, very rarely
written collections that expect highly concurrent reads. Read operations
are performed on a reference to the internal TreeSet at the
time of invocation, so will not see any mutations to the collection during
their operation.
Note that due to the use of a TreeSet internally,
a Comparator instance must be provided, or collection
elements must implement Comparable.
| 构造器和说明 |
|---|
SortedCopyOnWriteSet() |
SortedCopyOnWriteSet(Collection<? extends E> c) |
SortedCopyOnWriteSet(Comparator<? super E> comparator) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(E e) |
boolean |
addAll(Collection<? extends E> c) |
void |
clear() |
Comparator<? super E> |
comparator() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
E |
first() |
SortedSet<E> |
headSet(E toElement) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
E |
last() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
SortedSet<E> |
subSet(E fromElement,
E toElement) |
SortedSet<E> |
tailSet(E fromElement) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
public SortedCopyOnWriteSet()
public SortedCopyOnWriteSet(Collection<? extends E> c)
public SortedCopyOnWriteSet(Comparator<? super E> comparator)
public boolean contains(Object o)
public boolean containsAll(Collection<?> c)
containsAll 在接口中 Collection<E>containsAll 在接口中 Set<E>public boolean addAll(Collection<? extends E> c)
public boolean retainAll(Collection<?> c)
public boolean removeAll(Collection<?> c)
public Comparator<? super E> comparator()
comparator 在接口中 SortedSet<E>Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.