# Class DelegatingIterator<T>

java.lang.Object
htsjdk.samtools.util.DelegatingIterator<T>

All Implemented Interfaces:
  `CloseableIterator<T>, Closeable, AutoCloseable, Iterator<T>`

public class DelegatingIterator<T> extends Object implements CloseableIterator<T>
Simple iterator class that delegates all method calls to an underlying iterator. Useful for in-line subclassing to add behaviour to one or more methods.

## Constructor Summary

Constructors
Constructor
Description
`DelegatingIterator(Iterator<T> iterator)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
Should be implemented to close/release any underlying resources.
`boolean`
`hasNext()`
`T`
`next()`
`void`
`remove()`

### Methods inherited from class Object

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

### Methods inherited from interface CloseableIterator

`stream, toList`

### Methods inherited from interface Iterator

`forEachRemaining`

## Constructor Details

### DelegatingIterator

public DelegatingIterator(Iterator<T> iterator)

## Method Details

### close

public void close()
Description copied from interface: `CloseableIterator`
Should be implemented to close/release any underlying resources.

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `CloseableIterator<T>`

### hasNext

public boolean hasNext()

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

### next

public T next()

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

### remove

public void remove()

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