Class IterableUsingIteratorSupplier<T>

java.lang.Object
net.sf.saxon.tree.jiter.IterableUsingIteratorSupplier<T>
Type Parameters:
T -
All Implemented Interfaces:
Iterable<T>

public class IterableUsingIteratorSupplier<T> extends Object implements Iterable<T>
Implements an iterable over a Supplier<Iterator<T>> -- if a class can supply iterators on demand, then it can implement Iterable
  • Constructor Details

    • IterableUsingIteratorSupplier

      public IterableUsingIteratorSupplier(Supplier<Iterator<T>> iteratorSupplier)
      Create an iterable, whose iterator() method will get an iterator from the supplier provided.
      Parameters:
      iteratorSupplier - the supplier of iterators, to be called whenever a new iterator is required
  • Method Details

    • iterator

      public Iterator<T> iterator()
      Returns an iterator over elements of type T.
      Specified by:
      iterator in interface Iterable<T>
      Returns:
      an Iterator.