Class KllSketchIterator

java.lang.Object
org.apache.datasketches.kll.KllSketchIterator
All Implemented Interfaces:
QuantilesSketchIteratorAPI
Direct Known Subclasses:
KllDoublesSketchIterator, KllFloatsSketchIterator, KllItemsSketchIterator, KllLongsSketchIterator

public class KllSketchIterator extends Object implements QuantilesSketchIteratorAPI
The base implementation for the KLL sketch iterator hierarchy used for viewing the non-ordered quantiles retained by a sketch.

Prototype example of the recommended iteration loop:

  SketchIterator itr = sketch.iterator();
  while (itr.next()) {
    ...get*();
  }
Author:
Lee Rhodes
  • Method Details

    • getWeight

      public long getWeight()
      Description copied from interface: QuantilesSketchIteratorAPI
      Gets the natural weight at the current index.

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

      Specified by:
      getWeight in interface QuantilesSketchIteratorAPI
      Returns:
      the natural weight at the current index.
    • next

      public boolean next()
      Description copied from interface: QuantilesSketchIteratorAPI
      Advances the index and checks if it is valid. The state of this iterator is undefined before the first call of this method.
      Specified by:
      next in interface QuantilesSketchIteratorAPI
      Returns:
      true if the next index is valid.