Package org.apache.lucene.util.hnsw

# Class HnswGraph.NodesIterator

java.lang.Object
org.apache.lucene.util.hnsw.HnswGraph.NodesIterator

All Implemented Interfaces:
  `Iterator<Integer>`, `PrimitiveIterator<Integer,IntConsumer>`, `PrimitiveIterator.OfInt`

Direct Known Subclasses:
  `HnswGraph.ArrayNodesIterator`, `HnswGraph.CollectionNodesIterator`

Enclosing class:
  `HnswGraph`

public abstract static class HnswGraph.NodesIterator extends Object implements PrimitiveIterator.OfInt
Iterator over the graph nodes on a certain level. Iterator also provides the size – the total number of nodes to be iterated over. The nodes are NOT guaranteed to be presented in any particular order.

## Nested Class Summary

## Nested classes/interfaces inherited from interface java.util.PrimitiveIterator

`PrimitiveIterator.OfDouble, PrimitiveIterator.OfInt, PrimitiveIterator.OfLong`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final int`
`size`

## Constructor Summary

Constructors
Constructor
Description
`NodesIterator(int size)`
Constructor for iterator based on the size

## Method Summary

Modifier and Type
Method
Description
`abstract int`
`consume(int[] dest)`
Consume integers from the iterator and place them into the `dest` array.
`static int[]`
`getSortedNodes(HnswGraph.NodesIterator nodesOnLevel)`
`int`
`size()`
The number of elements in this iterator *

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

`hasNext, remove`

### Methods inherited from interface java.util.PrimitiveIterator.OfInt

`forEachRemaining, forEachRemaining, next, nextInt`

## Field Details

### size

protected final int size

## Constructor Details

### NodesIterator

public NodesIterator(int size)
Constructor for iterator based on the size

## Method Details

### size

public int size()
The number of elements in this iterator *

### consume

public abstract int consume(int[] dest)
Consume integers from the iterator and place them into the `dest` array.

Parameters:
  `dest` - where to put the integers
Returns:
  The number of integers written to `dest`

### getSortedNodes

public static int[] getSortedNodes(HnswGraph.NodesIterator nodesOnLevel)