org.apache.cassandra.utils.btree

## Class BTreeSearchIterator<K,V>

- java.lang.Object
- - org.apache.cassandra.utils.btree.BTreeSearchIterator<K,V>

All Implemented Interfaces:
  java.util.Iterator<V>, IndexedSearchIterator<K,V>, SearchIterator<K,V>

    public class BTreeSearchIterator<K,V>
    extends java.lang.Object
    implements IndexedSearchIterator<K,V>, java.util.Iterator<V>

### Constructor Summary

Constructors
Constructor and Description
`BTreeSearchIterator(java.lang.Object[] btree, java.util.Comparator<? super K> comparator, BTree.Dir dir)`

### Method Summary

All Methods Instance Methods Concrete Methods
`V` `current()`
`boolean` `hasNext()`
`int` `indexOfCurrent()`
`V` `next()`
`V` `next(K target)` Searches "forwards" (in direction of travel) in the iterator for the required key; if this or any key greater has already been returned by the iterator, the method may choose to return null, the correct or incorrect output, or fail an assertion.
`void` `rewind()` Reset this Iterator to its starting position

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

### Constructor Detail

#### BTreeSearchIterator

    public BTreeSearchIterator(java.lang.Object[] btree,
                               java.util.Comparator<? super K> comparator,
                               BTree.Dir dir)

### Method Detail

#### hasNext

    public boolean hasNext()

Specified by:
  `hasNext` in interface `java.util.Iterator<V>`
Specified by:
  `hasNext` in interface `IndexedSearchIterator<K,V>`
Returns:
  true if iterator has any elements left, false otherwise

#### next

    public V next()

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

#### next

    public V next(K target)

Description copied from interface: `SearchIterator`
Searches "forwards" (in direction of travel) in the iterator for the required key; if this or any key greater has already been returned by the iterator, the method may choose to return null, the correct or incorrect output, or fail an assertion. it is permitted to search past the end of the iterator, i.e. `!hasNext() => next(?) == null`

Specified by:
  `next` in interface `SearchIterator<K,V>`
Parameters:
  `target` - to search for
Returns:
  value associated with key, if present in direction of travel

#### rewind

    public void rewind()

Reset this Iterator to its starting position

#### current

    public V current()

Specified by:
  `current` in interface `IndexedSearchIterator<K,V>`
Returns:
  the value just recently returned by next()

#### indexOfCurrent

    public int indexOfCurrent()

Specified by:
  `indexOfCurrent` in interface `IndexedSearchIterator<K,V>`
Returns:
  the index of the value returned by current(), and just returned by next()