On Wed, 16 Jul 2025 17:46:33 GMT, Brian Burkhalter <b...@openjdk.org> wrote:

>> Address the same problem as in #26224 but for the `listFiles` variants with 
>> a filter parameter.
>
> Brian Burkhalter has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8362429: Add list(FilenameFilter) and toURL()

src/java.base/share/classes/java/io/File.java line 1227:

> 1225:                 File f = new File(s, this);
> 1226:                 if ((filter == null) || filter.accept(f))
> 1227:                     files.add(f);

Rather than duplicating the loop, it could be changed to introduce `boolean 
isEmpty = path.isEmpty` and then the `f` can be created with `File f = isEmpty 
? new File(s) : new File(this, s);`  It should be a bit cleaner.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26353#discussion_r2211253666

Reply via email to