Interface EnumerableSource<T>

Type Parameters:
T - the element type of the source
All Known Subinterfaces:
DeferredEnumerableSource<T>

public interface EnumerableSource<T>

Represents an unknown length iterable source which can be moved forward synchronously and obtain the current item via a simple call.

No hasNext and next duplication. C# IEnumerator is way better in this regard.

Since:
4.0.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the current item if nextSync() returned true the previous call.
    boolean
    Synchronously obtains the next item or returns false if no more items.
  • Method Details

    • nextSync

      boolean nextSync() throws Throwable
      Synchronously obtains the next item or returns false if no more items.
      Returns:
      true it there is an item available which can be obtained via current(), false if no more items are available
      Throws:
      Throwable - if there is a (processing) error while going to the next item synchronously
    • current

      T current()
      Returns the current item if nextSync() returned true the previous call.

      Calling before the first or after exhaustion of the source is an undefined behavior

      Returns:
      the current item