суббота, 21 апреля 2018 г.

Java 8. Files.lines() can cause possible resource leak.

Files.lines() method allows to receive stream of lines from file.
It seems to be very convenient apart from one thing - it can cause resource leak.
You must close this stream explicitly or use try with resource block.

It seems to be strange that terminal operations in this case doesn't close the resources underneath a stream.

Комментариев нет:

Отправить комментарий