CloseableStream exceptions [was: Re: experience trying out lambda-8-b74]

Olexandr Demura oleksander.demura at gmail.com
Tue Feb 5 06:47:10 PST 2013


Isn't ConsumerEx imply existence of StreamEx &Co. so we do not need any
wraps?
where `StreamEx<T, Ex>` extends `BaseStream<T>`
and `ConsumerEx<T, Ex> { void accept(T o) throws Ex }` is not related to
`Consumer<T>`,
just like with primitives - other essential and dominant java feature.

Then void `close() throws Exception` is natural, leading to `Closeable`
`StreamEx`.

2013/2/5 Zhong Yu <zhong.j.yu at gmail.com>

> Say we cannot do
>
>     Consumer<Path> deleteAction = Files::delete;
>
> since Files.delete() throws IOException. But a generic wrapper would do
>
>     Consumer<Path> deleteAction = wrap(Files::delete);
>
>     static <T> Consumer<T> wrap(ConsumerEx<T>){..}
>     // ... and wrap() for other functional interfaces
>
> Zhong Yu
>


More information about the lambda-dev mailing list