RFR: JDK-8263545: Convert jpackage to use Stream.toList()

Ian Graves igraves at openjdk.java.net
Mon Mar 15 17:55:10 UTC 2021


On Mon, 15 Mar 2021 17:31:10 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:

>> This converts jpackage to use `Stream.toList()` instead of `Stream.collect(Collectors.toList())`. One piece of code was modified to not mutate a list in addition to one test that used a mutating sort on a list. The rest of the changes are simple substitutions.
>
> src/jdk.jpackage/share/classes/jdk/jpackage/internal/DottedVersion.java line 151:
> 
>> 149:             components.add(BigInteger.ZERO);
>> 150:         }
>> 151:         return components.stream().toList().toArray(BigInteger[]::new);
> 
> I guess this can be simplified down to `components.stream().toArray(BigInteger[]::new);`

Good catch!

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

PR: https://git.openjdk.java.net/jdk/pull/2997


More information about the core-libs-dev mailing list