Stream operations -- current set

Remi Forax forax at univ-mlv.fr
Fri Sep 14 14:45:45 PDT 2012


On 09/14/2012 10:56 PM, Brian Goetz wrote:
> Here's the current set of stream operations.

>
> Terminal / Eager
> ----------------
>
>     void forEach(Block<? super T> block);
>
>     <A extends Destination<? super T>> A into(A target);
>
>     Object[] toArray();
>
>     <U> Map<U, Collection<T>> groupBy(Mapper<? super T, ? extends U> 
> classifier);
>
>     <U, W> Map<U, W> reduceBy(Mapper<? super T, ? extends U> classifier,
>                               Factory<W> baseFactory,
>                               Combiner<W, T, W> reducer);
>
>     T reduce(T base, BinaryOperator<T> op);
>     Optional<T> reduce(BinaryOperator<T> op);
>
>     <U> U fold(Factory<U> baseFactory,
>                Combiner<U, T, U> reducer,
>                BinaryOperator<U> combiner);
>
>     boolean anyMatch(Predicate<? super T> predicate);
>     boolean allMatch(Predicate<? super T> predicate);
>     boolean noneMatch(Predicate<? super T> predicate);
>
>     Optional<T> findFirst();
>     Optional<T> findAny();

There is a coherency problem, there is two versions of reduce, one with 
a base and one with Optional,
but findFirst/findAny have only one version.

Rémi



More information about the lambda-libs-spec-experts mailing list