Class MultitransformIterator<T,F>

java.lang.Object
org.cyclops.cyclopscore.datastructure.MultitransformIterator<T,F>
Type Parameters:
T - The type over which the resulting iterator will iterate over.
F - The output of the input iterator, and the input of the function.
All Implemented Interfaces:
Iterator<T>

public class MultitransformIterator<T,F> extends Object implements Iterator<T>
An iterator that takes an iterator as input, and applies each element of that iterator to a function that produces another iterator. The elements of all resulting iterators are produced by this. This is implemented in a lazy manner, meaning that the function will only be applied to elements when they are needed.
  • Constructor Details

  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<T>
    • next

      public T next()
      Specified by:
      next in interface Iterator<T>
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<T>
    • flattenIterableIterator

      public static <T> Iterator<T> flattenIterableIterator(Iterator<? extends Iterable<T>> it)
      Flatten the given nested iterator.
      Type Parameters:
      T - The type of the inner iterators.
      Parameters:
      it - An iterator over iterators.
      Returns:
      A flattened iterator.