On Sun, 26 Sept 2021 at 10:29, Tagir Valeev <amae...@gmail.com> wrote: > List<Path> list = > Files.list(Path.of("/etc")).map(Path::getFileName).consumeAndClose(Stream::toList); > > What do you think?
I fully support this. We have our own utility to do this kind of thing, as bugs with `Files` are common: https://github.com/OpenGamma/Strata/blob/main/modules/collect/src/main/java/com/opengamma/strata/collect/io/SafeFiles.java Stephen