Usage of Stream.forEachUntilCancelled
Mrityunjay Sharma
mrityunjay2002 at gmail.com
Sun Mar 24 06:29:01 PDT 2013
Hi All,
I was trying to use Stream.forEachUntilCancelled which takes a Consumer and
a BooleanSupplier as input parameter, as at any point of time this method
can cancel the iteration and return the control. I thought this would work
more like while-do statement, so that i can pass the
condition(BooleanSupplier) where the iteration needs to stop.
But as BooleanSupplier.getAsBoolean does not take any input parameter, then
how can we pass a condition where the iteration needs to stop. Is my
understanding correct or i am interpreting the method implementation
incorrectly.
*PS: An implementation Example will be highly appreciated.*
Thanks & Regards,
MJ
More information about the lambda-dev
mailing list