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.CloneableA thread-safeSortedSetimplementation 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 booleanadd(E e)booleanaddAll(java.util.Collection<? extends E> c)voidclear()ArraySortedSet<E>clone()java.util.Comparator<? super E>comparator()booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection<?> c)booleanequals(java.lang.Object o)Efirst()Efloor(E v)voidforEach(java.util.function.Consumer<? super E> action)inthashCode()java.util.SortedSet<E>headSet(E toElement)booleanisEmpty()java.util.Iterator<E>iterator()Elast()booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)intsize()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:
clonein classjava.lang.Object
-
iterator
@Nonnull public java.util.Iterator<E> iterator()
-
forEach
public void forEach(java.util.function.Consumer<? super E> action)
- Specified by:
forEachin 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:
comparatorin interfacejava.util.SortedSet<E>
-
subSet
@Nonnull public java.util.SortedSet<E> subSet(E fromElement, E toElement)
- Specified by:
subSetin interfacejava.util.SortedSet<E>
-
headSet
@Nonnull public java.util.SortedSet<E> headSet(E toElement)
- Specified by:
headSetin interfacejava.util.SortedSet<E>
-
tailSet
@Nonnull public java.util.SortedSet<E> tailSet(E fromElement)
- Specified by:
tailSetin 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()
-
-