## org.h2.dev.store.btree
Class Cursor<K,V>

    java.lang.Object
      org.h2.dev.store.btree.Cursor<K,V>

Type Parameters:
  `K` - the key type
  `V` - the value type

All Implemented Interfaces:
  java.util.Iterator<K>

Direct Known Subclasses:
  ChangeCursor

    public class Cursor<K,V>

extends java.lang.Object
implements java.util.Iterator<K>

A cursor to iterate over elements in ascending order.

Field Summary
`protected K` `current`
`protected CursorPos` `currentPos`
`protected MVMap<K,V>` `map`
`protected java.util.ArrayList<CursorPos>` `parents`

Method Summary
`protected void` `fetchNext()` Fetch the next key.
`boolean` `hasNext()`
`CursorPos` `min(Page p, K from)` Visit the first key that is greater or equal the given key.
`K` `next()`
`CursorPos` `pop()` Remove the latest cursor position from the stack and return it.
`void` `push(CursorPos p)` Add a cursor position to the stack.
`void` `remove()`
`CursorPos` `visitChild(Page p, int childIndex)` Visit the first key within this child page.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### map

    protected final MVMap<K,V> map

### parents

    protected final java.util.ArrayList<CursorPos> parents

### currentPos

    protected CursorPos currentPos

### current

    protected K current

Method Detail

### next

    public K next()

  Specified by:
    `next` in interface `java.util.Iterator<K>`

### fetchNext

    protected void fetchNext()

  Fetch the next key.

### hasNext

    public boolean hasNext()

  Specified by:
    `hasNext` in interface `java.util.Iterator<K>`

### remove

    public void remove()

  Specified by:
    `remove` in interface `java.util.Iterator<K>`

### push

    public void push(CursorPos p)

  Add a cursor position to the stack.

  Parameters:
    `p` - the cursor position

### pop

    public CursorPos pop()

  Remove the latest cursor position from the stack and return it.

  Returns:
    the cursor position, or null if none

### min

    public CursorPos min(Page p,
                         K from)

  Visit the first key that is greater or equal the given key.

  Parameters:
    `p` - the page
    `from` - the key, or null
  Returns:
    the cursor position

### visitChild

    public CursorPos visitChild(Page p,
                                int childIndex)

  Visit the first key within this child page.

  Parameters:
    `p` - the page
    `childIndex` - the child index
  Returns:
    the cursor position