Closing the Stream returned from BufferedReader.lines()
Alan Bateman
Alan.Bateman at oracle.com
Mon Dec 2 01:20:56 PST 2013
On 02/12/2013 03:03, Zhong Yu wrote:
> In this code
>
> BufferedReader br = ...;
> Stream<String> stream = br.lines();
> stream.close(); // does not close `br`
>
> `stream.close()` does not trigger `br.close()`. I for one find that
> rather counter-intuitive. Can you guys explain the design choice? When
> should a Stream forward close() to its source and when should it not?
>
See discussion on core-libs-dev from about a week ago on the same topic:
http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-November/023289.html
More information about the lambda-dev
mailing list