Class HnswGraph.NodesIterator

  • All Implemented Interfaces:
    java.util.Iterator<java.lang.Integer>, java.util.PrimitiveIterator<java.lang.Integer,​java.util.function.IntConsumer>, java.util.PrimitiveIterator.OfInt
    Direct Known Subclasses:
    HnswGraph.ArrayNodesIterator, HnswGraph.CollectionNodesIterator
    Enclosing class:
    HnswGraph

    public abstract static class HnswGraph.NodesIterator
    extends java.lang.Object
    implements java.util.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.
    • Nested Class Summary

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

        java.util.PrimitiveIterator.OfDouble, java.util.PrimitiveIterator.OfInt, java.util.PrimitiveIterator.OfLong
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int size  
    • Constructor Summary

      Constructors 
      Constructor Description
      NodesIterator​(int size)
      Constructor for iterator based on the size
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      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 Detail

      • size

        protected final int size
    • Constructor Detail

      • NodesIterator

        public NodesIterator​(int size)
        Constructor for iterator based on the size
    • Method Detail

      • 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`