@Immutable public class LongSortedArraySet extends AbstractLongSortedSet implements Serializable
A sorted set of longs implemented using a sorted array. It’s much faster than LongArraySet
as it is able to use binary searches, while maintaining the space compactness of array-backed sets. Long sorted array sets are immutable.
No orders are supported other than the natural ordering.
Constructor and Description |
---|
LongSortedArraySet(Collection<Long> items)
Construct a new array set from a collection of items.
|
LongSortedArraySet(long[] items)
Construct a new array set from an array of items.
|
LongSortedArraySet(SortedKeyIndex ks)
Construct a new long sorted array set from a key domain.
|
Modifier and Type | Method and Description |
---|---|
LongComparator |
comparator() |
boolean |
contains(long key) |
long |
firstLong() |
SortedKeyIndex |
getDomain()
Deprecated.
Use
getIndex() . |
SortedKeyIndex |
getIndex()
Get the underlying key index implementation.
|
LongSortedSet |
headSet(long key) |
LongBidirectionalIterator |
iterator() |
LongBidirectionalIterator |
iterator(long key) |
long |
lastLong() |
int |
size() |
LongSortedSet |
subSet(long startKey,
long endKey) |
LongSortedSet |
tailSet(long key) |
first, headSet, last, longIterator, subSet, tailSet
equals, hashCode, rem, remove, remove
add, add, addAll, addAll, contains, containsAll, containsAll, isEmpty, rem, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toLongArray, toLongArray, toString
clear
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, addAll, containsAll, rem, removeAll, retainAll, toArray, toArray, toLongArray, toLongArray
spliterator
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray
parallelStream, removeIf, stream
public LongSortedArraySet(@Nonnull SortedKeyIndex ks)
Construct a new long sorted array set from a key domain.
ks
- The key set storage.public LongSortedArraySet(@Nonnull Collection<Long> items)
Construct a new array set from a collection of items.
items
- The set’s contents.public LongSortedArraySet(long[] items)
Construct a new array set from an array of items.
items
- The items to initialize the set with. The items are copied, the array is not reused.public SortedKeyIndex getIndex()
Get the underlying key index implementation.
@Deprecated public SortedKeyIndex getDomain()
getIndex()
.Get the index backing this array set.
public LongComparator comparator()
comparator
in interface LongSortedSet
comparator
in interface SortedSet<Long>
public long firstLong()
firstLong
in interface LongSortedSet
public long lastLong()
lastLong
in interface LongSortedSet
public LongBidirectionalIterator iterator()
iterator
in interface LongCollection
iterator
in interface LongIterable
iterator
in interface LongSet
iterator
in interface LongSortedSet
iterator
in interface Iterable<Long>
iterator
in interface Collection<Long>
iterator
in interface Set<Long>
iterator
in class AbstractLongSortedSet
public LongBidirectionalIterator iterator(long key)
iterator
in interface LongSortedSet
public LongSortedSet subSet(long startKey, long endKey)
subSet
in interface LongSortedSet
public LongSortedSet headSet(long key)
headSet
in interface LongSortedSet
public LongSortedSet tailSet(long key)
tailSet
in interface LongSortedSet
public int size()
size
in interface Collection<Long>
size
in interface Set<Long>
size
in class AbstractCollection<Long>
public boolean contains(long key)
contains
in interface LongCollection
contains
in class AbstractLongCollection