API question/request: Array to Stream
Brian Goetz
brian.goetz at oracle.com
Tue Oct 1 07:46:13 PDT 2013
Try
Arrays.stream(array)
or
Stream.of(array)
On Oct 1, 2013, at 3:24 PM, Millies, Sebastian 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());
> }
>
> Sebastian Millies
> Software AG
> Expert webMethods Business Analytics
> Phone: +49 681 210-3221 | Fax: +49 681 210-1801
> Software AG
> Altenkesseler Str. 17 | 66115 Saarbrücken | Germany
> www.softwareag.com<http://www.softwareag.com>
>
>
> Software AG - Sitz/Registered office: Uhlandstraße 12, 64297 Darmstadt, Germany - Registergericht/Commercial register: Darmstadt HRB 1562 - Vorstand/Management Board: Karl-Heinz Streibich (Vorsitzender/Chairman), Dr. Wolfram Jost, Arnd Zinnhardt; - Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Dr. Andreas Bereczky - http://www.softwareag.com
>
>
More information about the lambda-dev
mailing list