Class SingleUseIterable<T>

java.lang.Object
com.atlassian.confluence.util.SingleUseIterable<T>
All Implemented Interfaces:
Iterable<T>

@ParametersAreNonnullByDefault public class SingleUseIterable<T> extends Object implements Iterable<T>
An Iterable wrapper for an iterator. If the iterator is retrieved more than once, an exception will be thrown.
  • Method Details

    • create

      public static <T> @NonNull SingleUseIterable<T> create(Iterator<T> iterator)
      Convenience static factory because constructors can't infer generic types.
      Parameters:
      iterator - the iterator to wrap
      Returns:
      the appropriately typed SingleUseIterator
    • iterator

      public @NonNull Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>