diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-01-17 22:41:28 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-01-17 22:49:38 +0100 |
commit | 16ea68abd238c91016df203d37047e5dd3037144 (patch) | |
tree | d8a5eb4df6dc74bfe010fd3179def2b90c0d164a | |
parent | 69a61e135e5cd7da5b14c18bc2cfe4785a8bee81 (diff) |
Unify on Streams.toList()
4 files changed, 7 insertions, 11 deletions
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AbstractGenerateOsgiManifestMojo.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AbstractGenerateOsgiManifestMojo.java index 00c915b8b91..e5b9938cdb4 100644 --- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AbstractGenerateOsgiManifestMojo.java +++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AbstractGenerateOsgiManifestMojo.java @@ -33,7 +33,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import static com.yahoo.container.plugin.util.IO.withFileOutputStream; -import static java.util.stream.Collectors.toList; /** * @author bjorncs @@ -175,7 +174,7 @@ abstract class AbstractGenerateOsgiManifestMojo extends AbstractMojo { String[] parts = projectVersion.split("-", 2); List<String> numericPart = Stream.of(parts[0].split("\\.")).map(s -> Strings.replaceEmptyString(s, "0")).limit(3) - .collect(toList()); + .collect(Collectors.toCollection(ArrayList::new)); while (numericPart.size() < 3) { numericPart.add("0"); } diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateTestBundleOsgiManifestMojo.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateTestBundleOsgiManifestMojo.java index 5708d90f82f..9ee658ddc22 100644 --- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateTestBundleOsgiManifestMojo.java +++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateTestBundleOsgiManifestMojo.java @@ -26,7 +26,6 @@ import static com.yahoo.container.plugin.util.TestBundleUtils.outputDirectory; import static com.yahoo.container.plugin.osgi.ExportPackages.exportsByPackageName; import static com.yahoo.container.plugin.osgi.ImportPackages.calculateImports; import static com.yahoo.container.plugin.util.Files.allDescendantFiles; -import static java.util.stream.Collectors.toList; /** * @author bjorncs @@ -44,7 +43,7 @@ public class GenerateTestBundleOsgiManifestMojo extends AbstractGenerateOsgiMani List<File> providedJars = artifactSet.getJarArtifactsProvided().stream() .map(Artifact::getFile) - .collect(toList()); + .toList(); List<Export> exportedPackagesFromProvidedJars = exportedPackagesAggregated(providedJars); @@ -79,7 +78,7 @@ public class GenerateTestBundleOsgiManifestMojo extends AbstractGenerateOsgiMani allDescendantFiles(new File(project.getBuild().getTestOutputDirectory()))) .filter(file -> file.getName().endsWith(".class")) .map(classFile -> Analyze.analyzeClass(classFile, null)) - .collect(toList()); + .toList(); } private static List<String> referencedTestCategories(List<ClassFileMetaData> analyzedClasses) { @@ -93,7 +92,7 @@ public class GenerateTestBundleOsgiManifestMojo extends AbstractGenerateOsgiMani "ai.vespa.hosted.cd.ProductionTest") .filter(referencedClasses::contains) .map(name -> name.substring(19)) - .collect(toList()); + .toList(); } } diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/TestBundleDependencyScopeTranslator.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/TestBundleDependencyScopeTranslator.java index 65606633dee..dd2e41b6dc3 100644 --- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/TestBundleDependencyScopeTranslator.java +++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/TestBundleDependencyScopeTranslator.java @@ -13,7 +13,6 @@ import java.util.function.Function; import java.util.logging.Logger; import java.util.stream.Collectors; -import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toMap; /** @@ -60,7 +59,7 @@ public class TestBundleDependencyScopeTranslator implements Artifacts.ScopeTrans .map(String::strip) .filter(s -> !s.isBlank()) .map(TestBundleDependencyScopeTranslator::toDependencyOverride) - .collect(toList()); + .toList(); } private static DependencyOverride toDependencyOverride(String overrideString) { @@ -96,7 +95,7 @@ public class TestBundleDependencyScopeTranslator implements Artifacts.ScopeTrans .skip(1) // Maven project itself is the first entry .map(otherArtifacts::get) .filter(Objects::nonNull) - .collect(toList()); + .toList(); } private static class DependencyOverride { diff --git a/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java b/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java index e2b53879d92..9a360c3d350 100644 --- a/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java +++ b/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java @@ -18,7 +18,6 @@ import java.util.logging.Logger; import static java.util.logging.Level.FINE; import static java.util.logging.Level.SEVERE; import static java.util.logging.Level.WARNING; -import static java.util.stream.Collectors.toList; /** * Used for subscribing to one or more configs. Can optionally be given a {@link ConfigSource} for the configs @@ -495,7 +494,7 @@ public class ConfigSubscriber implements AutoCloseable { log.log(WARNING, stackTraceAtConstruction, () -> String.format("%s: Closing subscription from finalizer() - close() has not been called (keys=%s)", super.toString(), - subscriptionHandles.stream().map(handle -> handle.subscription().getKey().toString()).collect(toList()))); + subscriptionHandles.stream().map(handle -> handle.subscription().getKey().toString()).toList())); close(); } } finally { |