(original) (raw)
Questions:
How often is the BooleanSupplier called?
Can one implement a BooleanSupplier that depended on the number of elements generated? �(Or would you just use a lazy range method instead?)
Doesn't cancellation occur as soon as the supplier returns false? �If so, what's the advantage of an onCancel method? �Or is it possible for the stream to be canceled by some other means?
�
The way this works is that it polls the supplied BooleanSupplier to ask "should we cancel now." �Once canceled, it acts as a gate shutting; no more elements are sent downstream, so downstream processing completes as if the stream were truncated. �When cancelation occurs, it calls the onCancel Runnable so that the client can have a way to know that the pipeline completed due to cancelation rather than normal completion.
On Sat, Dec 8, 2012 at 11:27 AM, Brian Goetz <brian.goetz@oracle.com> wrote:
The way this works is that it polls the supplied BooleanSupplier to ask "should we cancel now." �Once canceled, it acts as a gate shutting; no more elements are sent downstream, so downstream processing completes as if the stream were truncated. �When cancelation occurs, it calls the onCancel Runnable so that the client can have a way to know that the pipeline completed due to cancelation rather than normal completion.