public class TreeOrderedSetCache extends Object implements RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
TreeSet
.LEXICOGRAPHIC_BYTE_COMPARATOR
Modifier and Type | Method and Description |
---|---|
boolean |
add(byte[] toAdd)
Adds the given element, if it was not already contained.
|
void |
bulkLoadFromOrderedIterator(Iterator<byte[]> orderedIterator)
Clears the cache and adds up to
maxSize() elements from the iterator to the cache. |
boolean |
isEmpty()
Returns
size() == 0 . |
boolean |
isFull()
Returns
size() == maxSize() . |
int |
maxSize()
Returns the maximum number of elements that can be stored in the cache.
|
byte[] |
peekFirst()
Returns the first element or
null if empty. |
byte[] |
peekLast()
Returns the last element or
null if empty. |
byte[] |
pollFirst()
Returns and removes the first element or returns
null if empty. |
byte[] |
pollLast()
Returns and removes the last element or returns
null if empty. |
boolean |
remove(byte[] toRemove)
Removes the given element, if it is contained.
|
int |
size()
Returns the number of contained elements.
|
public int size()
RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
size
in interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
public int maxSize()
RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
maxSize
in interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
public boolean isEmpty()
RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
size() == 0
.isEmpty
in interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
public boolean isFull()
RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
size() == maxSize()
.isFull
in interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
public boolean add(@Nonnull byte[] toAdd)
RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
true
iff the cache was modified.add
in interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
public boolean remove(@Nonnull byte[] toRemove)
RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
true
iff the cache was modified.remove
in interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
@Nullable public byte[] peekFirst()
RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
null
if empty.peekFirst
in interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
@Nullable public byte[] peekLast()
RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
null
if empty.peekLast
in interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
@Nullable public byte[] pollFirst()
RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
null
if empty.pollFirst
in interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
@Nullable public byte[] pollLast()
RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
null
if empty.pollLast
in interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
public void bulkLoadFromOrderedIterator(@Nonnull Iterator<byte[]> orderedIterator)
RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
maxSize()
elements from the iterator to the cache.
Iterator must be ordered in the same order as this cache.bulkLoadFromOrderedIterator
in interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
orderedIterator
- iterator with elements in-order.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.