Package htsjdk.samtools.util

# Class AbstractIterator<E>

java.lang.Object
htsjdk.samtools.util.AbstractIterator<E>

All Implemented Interfaces:
  `Iterator<E>`

Direct Known Subclasses:
  `LineIteratorImpl`

public abstract class AbstractIterator<E> extends Object implements Iterator<E>
Base class of implementing iterators. All you have to do is implement advance which gets the next element.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected E`
`next`

## Constructor Summary

Constructors
Constructor
Description
`AbstractIterator()`

## Method Summary

Modifier and Type
Method
Description
`protected abstract E`
`advance()`
`boolean`
`hasNext()`
`protected boolean`
`isIterating()`
`E`
`next()`
`E`
`peek()`
Returns the next element in the iterator, if one exists.
`void`
`remove()`

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

### next

protected E next

## Constructor Details

### AbstractIterator

public AbstractIterator()

## Method Details

### hasNext

public boolean hasNext()

Specified by:
  `hasNext` in interface `Iterator<E>`

### next

public E next()

Specified by:
  `next` in interface `Iterator<E>`

### remove

public void remove()

Specified by:
  `remove` in interface `Iterator<E>`

### advance

protected abstract E advance()

Returns:
  the next element or null if the iterator is at the end

### peek

public E peek()
Returns the next element in the iterator, if one exists. Otherwise, returns null. Invoking this method does not advance the iterator.

Returns:
  The next element in the iterator, without advancing, or, if no other element exists, null.

### isIterating

protected boolean isIterating()

Returns:
  true after the first time hasNext() or next() have been called