Class LazyIterator<InputType, ReturnType>

java.lang.Object
fr.inria.rules.integraal.component_builder.evaluators.generic.processors.LazyIterator<InputType, ReturnType>
Type Parameters:
InputType - the type of elements in the source collection
ReturnType - the type of elements to be returned after transformation
All Implemented Interfaces:
Iterable<ReturnType>

public class LazyIterator<InputType, ReturnType> extends Object implements Iterable<ReturnType>
The LazyIterator is a generic iterable that provides a way to lazily process elements of a collection using a specified transformation function. This allows for deferred execution of the transformation logic, which can be beneficial for performance in certain scenarios.
  • Constructor Details

    • LazyIterator

      public LazyIterator(Collection<InputType> source, Function<InputType, ReturnType> lazyTransformationFunction)
      Constructs a LazyIterator with the given source collection and transformation function.
      Parameters:
      source - the source collection containing elements of type InputType
      lazyTransformationFunction - the function to apply to each element of the source, which transforms an element of type InputType into type ReturnType
  • Method Details

    • iterator

      public Iterator<ReturnType> iterator()
      Returns an iterator over elements of type ReturnType, each transformed from elements of type InputType using the provided transformation function.
      Specified by:
      iterator in interface Iterable<InputType>
      Returns:
      an Iterator over elements of type ReturnType