Class EditingFloatIterator

java.lang.Object
com.github.tommyettinger.ds.support.util.EditingFloatIterator
All Implemented Interfaces:
FloatIterator, Iterator<Float>

public class EditingFloatIterator extends Object implements FloatIterator
Wraps an Iterator so that it calls a function on each item it would otherwise return, and returns that function's result. If you need to return a different type than what the iterator returns, you can use an AlteringIterator. This has undefined behavior if any items the Iterator could return are modified during iteration.
You can change both the Iterator and editor at once using set(FloatIterator, FloatToFloatFunction) , and can also just change the Iterator with set(FloatIterator).
  • Field Details

    • iterator

      public FloatIterator iterator
    • editor

      public com.github.tommyettinger.function.FloatToFloatFunction editor
  • Constructor Details

    • EditingFloatIterator

      public EditingFloatIterator()
    • EditingFloatIterator

      public EditingFloatIterator(FloatIterator iterator, com.github.tommyettinger.function.FloatToFloatFunction editor)
  • Method Details

    • set

      public void set(FloatIterator iterator, com.github.tommyettinger.function.FloatToFloatFunction editor)
    • set

      public void set(FloatIterator iterator)
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<Float>
    • nextFloat

      public float nextFloat()
      Description copied from interface: FloatIterator
      Returns the next float element in the iteration.
      Specified by:
      nextFloat in interface FloatIterator
      Returns:
      the next float element in the iteration
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<Float>