API question/request: Array to Stream
Aleksey Shipilev
aleksey.shipilev at oracle.com
Tue Oct 1 08:25:47 PDT 2013
On 10/01/2013 05: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());
> }
>
Venkat is just old-school. See:
http://download.java.net/jdk8/docs/api/java/util/Arrays.html#stream(T[])
-Aleksey.
More information about the lambda-dev
mailing list