On Jun 4, 2015, at 9:04 AM, Remi Forax <fo...@univ-mlv.fr> wrote:
> Thinking a little more about dropWhile(),
> it can be written using filter() more or less like this:
>  default Stream<T> dropWhile(Predicate<? super T> predicate) {
>     return filter(new Predicate<>() {
>       private boolean noDropAnymore;
>       public boolean test(T t) {
>         return noDropAnymore || (noDropAnymore = !predicate.test(t));
>       }
>     });
>  }
> and i maybe wrong but implementing dropWhile with an op is not better than 
> that in term of perf so for me dropWhile() doesn't pull its own weight.
> 

Try running that in parallel.

(Stream.parallel() affects the whole pipeline, so it's not possible to 
implement the default with sequential().filter(p) where p is a stateful 
predicate.)
 
Paul.

Reply via email to