org.apache.hadoop.hbase.util
Class SortedCopyOnWriteSet<E>
java.lang.Object
org.apache.hadoop.hbase.util.SortedCopyOnWriteSet<E>
- Type Parameters:
E - A class implementing Comparable or able to be
compared by a provided comparator.
- All Implemented Interfaces:
- Iterable<E>, Collection<E>, Set<E>, SortedSet<E>
@InterfaceAudience.Public
@InterfaceStability.Stable
public class SortedCopyOnWriteSet<E>
- extends Object
- implements SortedSet<E>
Simple 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.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SortedCopyOnWriteSet
public SortedCopyOnWriteSet()
SortedCopyOnWriteSet
public SortedCopyOnWriteSet(Collection<? extends E> c)
SortedCopyOnWriteSet
public SortedCopyOnWriteSet(Comparator<? super E> comparator)
size
public int size()
- Specified by:
size in interface Collection<E>- Specified by:
size in interface Set<E>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface Collection<E>- Specified by:
isEmpty in interface Set<E>
contains
public boolean contains(Object o)
- Specified by:
contains in interface Collection<E>- Specified by:
contains in interface Set<E>
iterator
public Iterator<E> iterator()
- Specified by:
iterator in interface Iterable<E>- Specified by:
iterator in interface Collection<E>- Specified by:
iterator in interface Set<E>
toArray
public Object[] toArray()
- Specified by:
toArray in interface Collection<E>- Specified by:
toArray in interface Set<E>
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray in interface Collection<E>- Specified by:
toArray in interface Set<E>
add
public boolean add(E e)
- Specified by:
add in interface Collection<E>- Specified by:
add in interface Set<E>
remove
public boolean remove(Object o)
- Specified by:
remove in interface Collection<E>- Specified by:
remove in interface Set<E>
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll in interface Collection<E>- Specified by:
containsAll in interface Set<E>
addAll
public boolean addAll(Collection<? extends E> c)
- Specified by:
addAll in interface Collection<E>- Specified by:
addAll in interface Set<E>
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll in interface Collection<E>- Specified by:
retainAll in interface Set<E>
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll in interface Collection<E>- Specified by:
removeAll in interface Set<E>
clear
public void clear()
- Specified by:
clear in interface Collection<E>- Specified by:
clear in interface Set<E>
comparator
public Comparator<? super E> comparator()
- Specified by:
comparator in interface SortedSet<E>
subSet
public SortedSet<E> subSet(E fromElement,
E toElement)
- Specified by:
subSet in interface SortedSet<E>
headSet
public SortedSet<E> headSet(E toElement)
- Specified by:
headSet in interface SortedSet<E>
tailSet
public SortedSet<E> tailSet(E fromElement)
- Specified by:
tailSet in interface SortedSet<E>
first
public E first()
- Specified by:
first in interface SortedSet<E>
last
public E last()
- Specified by:
last in interface SortedSet<E>
Copyright © 2013 The Apache Software Foundation. All Rights Reserved.