public class KVNavigableSet extends AbstractKVNavigableSet<byte[]>
keyFilter, keyRange, kv, prefixMode, reversed
bounds
Modifier | Constructor and Description |
---|---|
|
KVNavigableSet(KVStore kv)
Constructor for when there are no range restrictions.
|
protected |
KVNavigableSet(KVStore kv,
boolean reversed,
KeyRange keyRange,
KeyFilter keyFilter)
Primary constructor.
|
|
KVNavigableSet(KVStore kv,
byte[] prefix)
Constructor for when the range of visible
KVStore keys is all keys sharing a given byte[] prefix. |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Comparator<byte[]> |
comparator() |
protected NavigableSet<byte[]> |
createSubSet(boolean newReversed,
KeyRange newKeyRange,
KeyFilter newKeyFilter,
Bounds<byte[]> newBounds)
Create a (possibly reversed) view of this instance with (possibly) tighter lower and/or upper bounds and
the given
KeyFilter , if any. |
protected byte[] |
decode(ByteReader reader)
Decode an element from a
byte[] key. |
protected void |
encode(ByteWriter writer,
Object obj)
Encode the given object into a
byte[] key. |
boolean |
remove(Object obj)
Removes the given element from this set if it is present.
|
contains, createSubSet, encodeVisible, filterKeys, first, isEmpty, isVisible, isWithinLowerBound, isWithinUpperBound, iterator, last, pollFirst, pollLast
ceiling, descendingIterator, descendingSet, floor, getComparator, headSet, headSet, higher, lower, searchAbove, searchBelow, spliterator, subSet, subSet, tailSet, tailSet
equals, hashCode, size, toArray, toArray
removeAll
add, addAll, containsAll, retainAll, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, addAll, containsAll, equals, hashCode, removeAll, retainAll, size, toArray, toArray
parallelStream, removeIf, stream
public KVNavigableSet(KVStore kv)
kv
- underlying KVStore
public KVNavigableSet(KVStore kv, byte[] prefix)
KVStore
keys is all keys sharing a given byte[]
prefix.kv
- underlying KVStore
prefix
- prefix defining minimum and maximum keysNullPointerException
- if prefix
is nullprotected KVNavigableSet(KVStore kv, boolean reversed, KeyRange keyRange, KeyFilter keyFilter)
kv
- underlying KVStore
reversed
- whether ordering is reversedkeyRange
- key range restriction, or null for nonekeyFilter
- key filter, or null for noneIllegalArgumentException
- if kv
is nullpublic Comparator<byte[]> comparator()
public boolean remove(Object obj)
AbstractNavigableSet
The implementation in AbstractNavigableSet
always throws UnsupportedOperationException
.
remove
in interface Collection<byte[]>
remove
in interface Set<byte[]>
remove
in class AbstractNavigableSet<byte[]>
public void clear()
clear
in interface Collection<byte[]>
clear
in interface Set<byte[]>
clear
in class AbstractCollection<byte[]>
protected void encode(ByteWriter writer, Object obj)
AbstractKVNavigableSet
byte[]
key.
Note that this method must throw IllegalArgumentException
, not ClassCastException
or NullPointerException
, if obj
does not have the correct type or is an illegal null value.encode
in class AbstractKVNavigableSet<byte[]>
writer
- output for encoded byte[]
key corresponding to obj
obj
- set elementprotected byte[] decode(ByteReader reader)
AbstractKVNavigableSet
byte[]
key.
If not in prefix mode, all of reader
must be consumed; otherwise, the consumed portion
is the prefix and any following keys with the same prefix are ignored.
decode
in class AbstractKVNavigableSet<byte[]>
reader
- input for encoded bytesprotected NavigableSet<byte[]> createSubSet(boolean newReversed, KeyRange newKeyRange, KeyFilter newKeyFilter, Bounds<byte[]> newBounds)
AbstractKVNavigableSet
KeyFilter
, if any.
The bounds are consistent with the reversed ordering (i.e., reversed if reverse
is true)
and have already been range-checked against this instance's bounds.createSubSet
in class AbstractKVNavigableSet<byte[]>
newReversed
- whether the new set's ordering should be reversed (implies newBounds
are also inverted,
but not keyRange
); note: means "absolutely" reversed, not relative to this instancenewKeyRange
- new key range, or null for none; will be consistent with bounds
, if anynewKeyFilter
- new key filter, or null for nonenewBounds
- new boundsCopyright © 2022. All rights reserved.