Class 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 Detail

      • 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