Class SeqBuffer<T>

java.lang.Object
org.jooq.lambda.SeqBuffer<T>

final class SeqBuffer<T> extends Object
Lazily consumes given Spliterator through Seqs provided by method seq(). This method may be called multiple times, and the returned Seqs may be consumed interchangeably. Instances of this class ARE thread-safe.
  • Field Details

    • source

      private final Spliterator<T> source
    • buffer

      private final List<T> buffer
    • buffering

      private volatile boolean buffering
      True while source hasn't reported that it's exhausted. This volatile field acts as a memory barrier for the contents of source and buffer:
  • Constructor Details

  • Method Details

    • of

      static <T> SeqBuffer<T> of(Stream<? extends T> stream)
    • of

      static <T> SeqBuffer<T> of(Spliterator<T> spliterator)
    • seq

      Seq<T> seq()
      Returns a Seq over given source. Although such Seq is not thread-safe by itself, it interacts in a thread-safe way with its parent SeqBuffer. As a result, each Seq returned by this method can be safely used on a different thread.