@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, tailSetequals, hashCode, rem, remove, removeadd, add, addAll, addAll, contains, containsAll, containsAll, isEmpty, rem, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toLongArray, toLongArray, toStringclearclone, finalize, getClass, notify, notifyAll, wait, wait, waitadd, addAll, containsAll, rem, removeAll, retainAll, toArray, toArray, toLongArray, toLongArrayspliteratoradd, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArrayparallelStream, removeIf, streampublic 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 LongSortedSetcomparator in interface SortedSet<Long>public long firstLong()
firstLong in interface LongSortedSetpublic long lastLong()
lastLong in interface LongSortedSetpublic LongBidirectionalIterator iterator()
iterator in interface LongCollectioniterator in interface LongIterableiterator in interface LongSetiterator in interface LongSortedSetiterator in interface Iterable<Long>iterator in interface Collection<Long>iterator in interface Set<Long>iterator in class AbstractLongSortedSetpublic LongBidirectionalIterator iterator(long key)
iterator in interface LongSortedSetpublic LongSortedSet subSet(long startKey, long endKey)
subSet in interface LongSortedSetpublic LongSortedSet headSet(long key)
headSet in interface LongSortedSetpublic LongSortedSet tailSet(long key)
tailSet in interface LongSortedSetpublic 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 LongCollectioncontains in class AbstractLongCollection