Class ArraySortedSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- com.linkedin.alpini.base.concurrency.ArraySortedSet<E>
-
- Type Parameters:
E
-
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.Set<E>
,java.util.SortedSet<E>
public class ArraySortedSet<E> extends java.util.AbstractSet<E> implements java.util.SortedSet<E>, java.lang.Cloneable
A thread-safeSortedSet
implementation which uses an array as a backing store. Mutations to the backing store are guarded by a read-write lock. The purpose of this is to be a more garbage-collector friendly collection than ConcurrentSkipListSet at the cost of slightly more CPU cost at insert and deletion. When used as a backing store for AbstractQuantileEstimation, 5 million samples per second can be performed at the average invocation time of 3 microseconds.
-
-
Constructor Summary
Constructors Constructor Description ArraySortedSet(java.util.Comparator<? super E> comparator, int initialSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E e)
boolean
addAll(java.util.Collection<? extends E> c)
void
clear()
ArraySortedSet<E>
clone()
java.util.Comparator<? super E>
comparator()
boolean
contains(java.lang.Object o)
boolean
containsAll(java.util.Collection<?> c)
boolean
equals(java.lang.Object o)
E
first()
E
floor(E v)
void
forEach(java.util.function.Consumer<? super E> action)
int
hashCode()
java.util.SortedSet<E>
headSet(E toElement)
boolean
isEmpty()
java.util.Iterator<E>
iterator()
E
last()
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
boolean
retainAll(java.util.Collection<?> c)
int
size()
java.util.Spliterator<E>
spliterator()
java.util.SortedSet<E>
subSet(E fromElement, E toElement)
java.util.SortedSet<E>
tailSet(E fromElement)
java.lang.Object[]
toArray()
<T> T[]
toArray(T[] a)
-
-
-
Constructor Detail
-
ArraySortedSet
public ArraySortedSet(java.util.Comparator<? super E> comparator, int initialSize)
-
-
Method Detail
-
clone
public ArraySortedSet<E> clone()
- Overrides:
clone
in classjava.lang.Object
-
iterator
@Nonnull public java.util.Iterator<E> iterator()
-
forEach
public void forEach(java.util.function.Consumer<? super E> action)
- Specified by:
forEach
in interfacejava.lang.Iterable<E>
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
contains
public boolean contains(java.lang.Object o)
-
toArray
@Nonnull public java.lang.Object[] toArray()
-
toArray
@Nonnull public <T> T[] toArray(@Nonnull T[] a)
-
add
public boolean add(E e)
-
remove
public boolean remove(java.lang.Object o)
-
containsAll
public boolean containsAll(@Nonnull java.util.Collection<?> c)
-
addAll
public boolean addAll(@Nonnull java.util.Collection<? extends E> c)
-
comparator
public java.util.Comparator<? super E> comparator()
- Specified by:
comparator
in interfacejava.util.SortedSet<E>
-
subSet
@Nonnull public java.util.SortedSet<E> subSet(E fromElement, E toElement)
- Specified by:
subSet
in interfacejava.util.SortedSet<E>
-
headSet
@Nonnull public java.util.SortedSet<E> headSet(E toElement)
- Specified by:
headSet
in interfacejava.util.SortedSet<E>
-
tailSet
@Nonnull public java.util.SortedSet<E> tailSet(E fromElement)
- Specified by:
tailSet
in interfacejava.util.SortedSet<E>
-
spliterator
public java.util.Spliterator<E> spliterator()
-
equals
public boolean equals(java.lang.Object o)
-
hashCode
public int hashCode()
-
removeAll
public boolean removeAll(@Nonnull java.util.Collection<?> c)
-
retainAll
public boolean retainAll(@Nonnull java.util.Collection<?> c)
-
clear
public void clear()
-
-