RFR: 8345433: (fs) Use stream to load FileTypeDetectors in Files.probeContentType [v2]

Alan Bateman alanb at openjdk.org
Wed Dec 4 18:18:39 UTC 2024


On Wed, 4 Dec 2024 18:11:02 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Change `FileTypeDetector` list creation to use a stream rather than an iteration and adds.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8345433: Move toList() to separate line

src/java.base/share/classes/java/nio/file/Files.java line 1528:

> 1526:                                       ClassLoader.getSystemClassLoader())
> 1527:                 .stream()
> 1528:                 .map(p -> p.get())

This looks fine, the alternative is to use a method ref, as in map(ServiceLoader.Provider::get) if you want.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22552#discussion_r1870056976


More information about the nio-dev mailing list