From 3d42ab085a48d6427426572850d4a21ab672c39e Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Thu, 12 Jan 2023 17:32:44 +0100 Subject: [PATCH] Polish MavenMetadataVersionResolver --- .../boot/build/bom/bomr/MavenMetadataVersionResolver.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/MavenMetadataVersionResolver.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/MavenMetadataVersionResolver.java index b52bc18cbb..40055926fc 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/MavenMetadataVersionResolver.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/MavenMetadataVersionResolver.java @@ -17,8 +17,8 @@ package org.springframework.boot.build.bom.bomr; import java.io.StringReader; -import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.SortedSet; @@ -52,7 +52,7 @@ final class MavenMetadataVersionResolver implements VersionResolver { private final Collection repositoryUrls; MavenMetadataVersionResolver(Collection repositoryUrls) { - this(new RestTemplate(Arrays.asList(new StringHttpMessageConverter())), repositoryUrls); + this(new RestTemplate(Collections.singletonList(new StringHttpMessageConverter())), repositoryUrls); } MavenMetadataVersionResolver(RestTemplate restTemplate, Collection repositoryUrls) { @@ -66,7 +66,7 @@ final class MavenMetadataVersionResolver implements VersionResolver { for (String repositoryUrl : this.repositoryUrls) { versions.addAll(resolveVersions(groupId, artifactId, repositoryUrl)); } - return new TreeSet<>(versions.stream().map(DependencyVersion::parse).collect(Collectors.toSet())); + return versions.stream().map(DependencyVersion::parse).collect(Collectors.toCollection(TreeSet::new)); } private Set resolveVersions(String groupId, String artifactId, String repositoryUrl) {