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.
Комментариев нет:
Отправить комментарий