Files.lines() の返り値は try-with-resources で閉じる
Files.lines
は閉じていない BufferedReader を Stream に詰め込んで返すので、try-with-resources で閉じる必要がある。
The returned stream encapsulates a Reader. If timely disposal of file system resources is required, the try-with-resources construct should be used to ensure that the stream's close method is invoked after the stream operations are completed.
ref. http://mike-neck.hatenadiary.com/entry/2015/04/12/210000
Published: 2015-05-07(Thu) 23:24