Interface IndexableSource<T>

Type Parameters:
T - the element type of the source

public interface IndexableSource<T>
Represents a source which can be accessed via a zero-based index synchronously, without going through the usual Streamer.next() calls to obtain the next item.
Since:
4.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    elementAt(long index)
    Obtain an element from the given index.
    long
    Returns the limit of how many items can be obtained via [elementAt(long).
  • Method Details

    • elementAt

      @NonNull T elementAt(long index) throws Throwable
      Obtain an element from the given index. Make sure you read only up to limit()
      Parameters:
      index - the index
      Returns:
      the element at the specified index
      Throws:
      Throwable - if the indexed access involves computation that can throw
    • limit

      long limit()
      Returns the limit of how many items can be obtained via [elementAt(long).
      Returns:
      the index limit, exclusive