# Class GenericSortedViewIterator<T>

java.lang.Object
org.apache.datasketches.quantilescommon.SortedViewIterator
org.apache.datasketches.quantilescommon.GenericSortedViewIterator<T>

Type Parameters:
  `T` - The generic item class type

public class GenericSortedViewIterator<T> extends SortedViewIterator
Iterator over quantile sketches of generic type.

## Constructor Summary

Constructors
Constructor
Description
`GenericSortedViewIterator(T[] quantiles, long[] cumWeights)`
Constructor

## Method Summary

Modifier and Type
Method
Description
`T`
`getQuantile()`
Gets the quantile at the current index This is equivalent to getQuantile(INCLUSIVE).
`T`
`getQuantile(QuantileSearchCriteria searchCrit)`
Gets the quantile at the current index (or previous index) based on the chosen search criterion.

### Methods inherited from class SortedViewIterator

`getN, getNaturalRank, getNaturalRank, getNormalizedRank, getNormalizedRank, getWeight, next`

### Methods inherited from class Object

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

## Constructor Details

### GenericSortedViewIterator

public GenericSortedViewIterator(T[] quantiles, long[] cumWeights)
Constructor

Parameters:
  `quantiles` - the given array of quantiles
  `cumWeights` - the array of cumulative weights, corresponding to the array of quantiles, starting with the value one and the end value must equal N, the total number of items input to the sketch.

## Method Details

### getQuantile

public T getQuantile()
Gets the quantile at the current index This is equivalent to getQuantile(INCLUSIVE).

Don't call this before calling next() for the first time or after getting false from next().

Returns:
  the quantile at the current index.

### getQuantile

public T getQuantile(QuantileSearchCriteria searchCrit)
Gets the quantile at the current index (or previous index) based on the chosen search criterion.

Don't call this before calling next() for the first time or after getting false from next().

Parameters:
  `searchCrit` - if INCLUSIVE, includes the quantile at the current index. Otherwise, returns the quantile of the previous index.
Returns:
  the quantile at the current index (or previous index) based on the chosen search criterion. If the chosen search criterion is EXCLUSIVE and the current index is at zero, this will return null.