Write Stream<String> to a file?

Zhong Yu zhong.j.yu at gmail.com
Tue Nov 19 18:24:32 PST 2013


A problem with this is that most write() methods in java.io throw
checked IOException. PrintWriter does not throw checked exceptions -
it swallows them which is not good either.

On Tue, Nov 19, 2013 at 6:47 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> How about:
>
>     stream.forEachOrdered(writer::write);
>
>
> On 11/19/2013 6:19 PM, Zhong Yu wrote:
>>
>> We have convenience methods to read lines from a file:
>>      Stream<String> Files.lines()
>>
>> What's Java's idiomatic way to write a Stream<String> to a file?
>>
>> Zhong Yu
>>
>


More information about the lambda-dev mailing list