net.metanotion.io.block.index

## Class IBSkipIterator<K extends Comparable<? super K>,V>

- 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 iterator
    `V` - type of values returned by this iterator
  All Implemented Interfaces:
    Iterator<V>, ListIterator<V>

      public class IBSkipIterator<K extends Comparable<? super K>,V>
      extends SkipIterator<K,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

    - ### Fields inherited from class net.metanotion.util.skiplist.SkipIterator

      `index, ss`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IBSkipIterator(SkipSpan<K,V> ss, int index)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `V` | `next()`
    `K` | `nextKey()` The key.
    `V` | `previous()`

    - ### Methods inherited from class net.metanotion.util.skiplist.SkipIterator

      `add, hasNext, hasPrevious, nextIndex, previousIndex, remove, set`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Iterator

      `forEachRemaining`

- - ### Constructor Detail

    - #### IBSkipIterator

          public IBSkipIterator(SkipSpan<K,V> ss,
                                int index)

  - ### Method Detail

    - #### next

          public V next()

      Specified by:
        `next` in interface `Iterator<V>`
      Specified by:
        `next` in interface `ListIterator<V>`
      Overrides:
        `next` in class `SkipIterator<K extends Comparable<? super K>,V>`
      Returns:
        the next value, and advances the index
      Throws:
        `NoSuchElementException`
        `RuntimeException` - on IOE

    - #### nextKey

          public K nextKey()

      The key. Does NOT advance the index.
      Overrides:
        `nextKey` in class `SkipIterator<K extends Comparable<? super K>,V>`
      Returns:
        the key for which the value will be returned in the subsequent call to next()
      Throws:
        `NoSuchElementException`
        `RuntimeException` - on IOE

    - #### previous

          public V previous()

      Specified by:
        `previous` in interface `ListIterator<V>`
      Overrides:
        `previous` in class `SkipIterator<K extends Comparable<? super K>,V>`
      Returns:
        the previous value, and decrements the index
      Throws:
        `NoSuchElementException`
        `RuntimeException` - on IOE