net.metanotion.util.skiplist

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

- java.lang.Object
- - net.metanotion.util.skiplist.SkipIterator<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>
  Direct Known Subclasses:
    IBSkipIterator

      public class SkipIterator<K extends Comparable<? super K>,V>
      extends Object
      implements ListIterator<V>

  A basic iterator for a skip list. This is not a complete ListIterator, in particular, since the skip list is a map and is therefore indexed by Comparable objects instead of int's, nextIndex and previousIndex methods are not really relevant. To be clear, this is an iterator through values. To get the key, call nextKey() BEFORE calling next().

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `index`
    `protected SkipSpan<K,V>` | `ss`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `SkipIterator()`
    `` | `SkipIterator(SkipSpan<K,V> ss, int index)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(V o)`
    `boolean` | `hasNext()`
    `boolean` | `hasPrevious()`
    `V` | `next()`
    `int` | `nextIndex()`
    `K` | `nextKey()` The key.
    `V` | `previous()`
    `int` | `previousIndex()`
    `void` | `remove()`
    `void` | `set(V o)`

    - ### 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`

- - ### Field Detail

    - #### index

          protected int index

    - #### ss

          protected SkipSpan<K extends Comparable<? super K>,V> ss

  - ### Constructor Detail

    - #### SkipIterator

          protected SkipIterator()

    - #### SkipIterator

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

  - ### Method Detail

    - #### add

          public void add(V o)

      Specified by:
        `add` in interface `ListIterator<V>`

    - #### hasNext

          public boolean hasNext()

      Specified by:
        `hasNext` in interface `Iterator<V>`
      Specified by:
        `hasNext` in interface `ListIterator<V>`

    - #### hasPrevious

          public boolean hasPrevious()

      Specified by:
        `hasPrevious` in interface `ListIterator<V>`

    - #### next

          public V next()

      Specified by:
        `next` in interface `Iterator<V>`
      Specified by:
        `next` in interface `ListIterator<V>`
      Returns:
        the next value, and advances the index
      Throws:
        `NoSuchElementException`

    - #### nextIndex

          public int nextIndex()

      Specified by:
        `nextIndex` in interface `ListIterator<V>`

    - #### nextKey

          public K nextKey()

      The key. Does NOT advance the index.
      Returns:
        the key for which the value will be returned in the subsequent call to next()
      Throws:
        `NoSuchElementException`

    - #### previous

          public V previous()

      Specified by:
        `previous` in interface `ListIterator<V>`
      Returns:
        the previous value, and decrements the index
      Throws:
        `NoSuchElementException`

    - #### previousIndex

          public int previousIndex()

      Specified by:
        `previousIndex` in interface `ListIterator<V>`

    - #### remove

          public void remove()

      Specified by:
        `remove` in interface `Iterator<V>`
      Specified by:
        `remove` in interface `ListIterator<V>`

    - #### set

          public void set(V o)

      Specified by:
        `set` in interface `ListIterator<V>`