Closing the Stream returned from BufferedReader.lines()

Zhong Yu zhong.j.yu at
Sun Dec 1 19:03:56 PST 2013

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?


Zhong Yu

More information about the lambda-dev mailing list