API question/request: Array to Stream
Paul Sandoz
paul.sandoz at oracle.com
Tue Oct 1 07:16:40 PDT 2013
On Oct 1, 2013, at 3:24 PM, "Millies, Sebastian" <Sebastian.Millies at softwareag.com> wrote:
> Why can't I stream an array? It is awkward having to convert to a list first, cf.
> this code by Venkat Subramaniam:
>
> public void setFilters(Function<Color, Color>... filters) {
> this.filter =
> Arrays.asList(filters).stream() // <----
> .reduce((f, next) -> f.compose(next))
> .orElse(Function.<Color>identity());
> }
>
Use:
Stream.of(filters)...
Paul.
More information about the lambda-dev
mailing list