Module java.base

Interface Gatherer.Downstream<T>

Type Parameters:
T - the type of elements this downstream accepts to be pushed
Enclosing interface:
Gatherer<T,A,R>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface Gatherer.Downstream<T>
A Downstream is a handle to the next stage in a pipeline of operations, to which elements can be sent.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Allows for checking whether the destination represented by this Downstream is known to not want any more elements sent to it.
    boolean
    push(T element)
    Pushes, if possible, the provided element to the destination represented by this Downstream.
  • Method Details

    • push

      boolean push(T element)
      Pushes, if possible, the provided element to the destination represented by this Downstream.

      If this method returns false then this destination does not want any more elements.

      Parameters:
      element - the element to send
      Returns:
      true if more elements can be sent, and false if not.
    • isRejecting

      default boolean isRejecting()
      Allows for checking whether the destination represented by this Downstream is known to not want any more elements sent to it.
      API Note:
      This is best-effort only, once this returns true it should never return false again for the same instance. By default this method returns false.
      Returns:
      true if this Downstream is known not to want any more elements sent to it, false if otherwise