On Wed, 9 Jul 2025 18:04:08 GMT, Brian Burkhalter <b...@openjdk.org> wrote:

> Changes to address `File.listFiles` invoked on an empty path. This fixes an 
> oversight in #22821.

test/jdk/java/io/File/EmptyPath.java line 216:

> 214:         List<String> ioNames =
> 215:             Arrays.asList(files).stream().map(f -> 
> f.toString()).toList();
> 216:         Set<String> ioSet = new HashSet(ioNames);

You can simplify this by collecting into the set, e.g.

Set<String> ioSet = Arrays.stream(files)
                .map(File::getName)
                .collect(Collectors.toSet());

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26224#discussion_r2195697480

Reply via email to