public abstract class HeapIterator extends Object implements SortedKeyValueIterator<Key,Value>
PriorityQueue
of multiple SortedKeyValueIterators. Provides a simple way to interact with multiple SortedKeyValueIterators in sorted
order.Modifier | Constructor and Description |
---|---|
protected |
HeapIterator() |
protected |
HeapIterator(int maxSize) |
Modifier and Type | Method and Description |
---|---|
protected void |
addSource(SortedKeyValueIterator<Key,Value> source) |
protected void |
clear() |
protected void |
createHeap(int maxSize) |
Key |
getTopKey()
Returns top key.
|
Value |
getTopValue()
Returns top value.
|
boolean |
hasTop()
Returns true if the iterator has more elements.
|
void |
next()
Advances to the next K,V pair.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deepCopy, init, seek
protected HeapIterator()
protected HeapIterator(int maxSize)
protected void createHeap(int maxSize)
public final Key getTopKey()
SortedKeyValueIterator
For performance reasons, iterators reserve the right to reuse objects returned by getTopKey when SortedKeyValueIterator.next()
is called, changing the data that
the object references. Iterators that need to save an object returned by getTopKey ought to copy the object's data into a new object in order to
avoid aliasing bugs.
getTopKey
in interface SortedKeyValueIterator<Key,Value>
public final Value getTopValue()
SortedKeyValueIterator
For performance reasons, iterators reserve the right to reuse objects returned by getTopValue when SortedKeyValueIterator.next()
is called, changing the
underlying data that the object references. Iterators that need to save an object returned by getTopValue ought to copy the object's data into a
new object in order to avoid aliasing bugs.
getTopValue
in interface SortedKeyValueIterator<Key,Value>
public final boolean hasTop()
SortedKeyValueIterator
hasTop
in interface SortedKeyValueIterator<Key,Value>
public final void next() throws IOException
SortedKeyValueIterator
next
in interface SortedKeyValueIterator<Key,Value>
IOException
- if an I/O error occurs.protected final void clear()
protected final void addSource(SortedKeyValueIterator<Key,Value> source)
Copyright © 2011–2017 The Apache Software Foundation. All rights reserved.