java.lang.Object
net.metanotion.util.skiplist.SkipIterator<K,V>
net.metanotion.io.block.index.IBSkipIterator<K,V>
- Type Parameters:
K- type of keys maintained by this iteratorV- type of values returned by this iterator
- All Implemented Interfaces:
Iterator<V>, ListIterator<V>
SkipList iterator with on-demand span loading (I2P version).
Loads spans from disk only when needed and unloads them when moving to next span to minimize memory usage.
Overridden to load span when required and null out keys and values when iterator leaves the span. If caller does not iterate all the way through, the last span will remain in memory.
Field Summary
Constructor Summary
ConstructorsConstructorDescriptionIBSkipIterator(SkipSpan<K, V> ss, int index) Positions the underlying index at the starting key.Method Summary
All MethodsMethods inherited from class SkipIterator
add, hasNext, hasPrevious, nextIndex, previousIndex, remove, setMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining
Constructor Details
IBSkipIterator
Method Details
next
Next value in the iteration.- Specified by:
nextin interfaceIterator<K extends Comparable<? super K>>- Specified by:
nextin interfaceListIterator<K extends Comparable<? super K>>- Overrides:
nextin classSkipIterator<K extends Comparable<? super K>, V>- Returns:
- the next value, and advances the index
- Throws:
NoSuchElementException- if the iterator is past the last valueRuntimeException- wrapping any IOException from loading the span
nextKey
The key. Does NOT advance the index.- Overrides:
nextKeyin classSkipIterator<K extends Comparable<? super K>, V>- Returns:
- the key for which the value will be returned in the subsequent call to
next() - Throws:
NoSuchElementException- if the iterator is past the last keyRuntimeException- wrapping any IOException from loading the span
previous
Previous value in the iteration.- Specified by:
previousin interfaceListIterator<K extends Comparable<? super K>>- Overrides:
previousin classSkipIterator<K extends Comparable<? super K>, V>- Returns:
- the previous value, and decrements the index
- Throws:
NoSuchElementException- if the iterator is before the first valueRuntimeException- wrapping any IOException from loading the span