Why is Files.lines (and similar Streams) not automatically closed?
Yes, this was a deliberate decision. We considered both alternatives. The operating design principle here is “whoever acquires the resource should release the resource”. Files don’t auto-close when you read to EOF; we expect files to be closed explicitly by whoever opened them. Streams that are backed by IO resources are the same. Fortunately, the … Read more