Skip to content

Commit

Permalink
Replace Collectors.toList() with toList()
Browse files Browse the repository at this point in the history
  • Loading branch information
eddumelendez committed Nov 8, 2024
1 parent ad66be9 commit 0f613bb
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,6 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import io.spring.initializr.metadata.BillOfMaterials;
Expand Down Expand Up @@ -124,7 +123,7 @@ private List<Dependency> getManagedDependencies(List<BillOfMaterials> boms, List
return boms.stream()
.flatMap((bom) -> getManagedDependencies(bom.getGroupId(), bom.getArtifactId(), bom.getVersion(),
repositories))
.collect(Collectors.toList());
.toList();
}

private Stream<Dependency> getManagedDependencies(String groupId, String artifactId, String version,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,6 @@
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import io.spring.initializr.generator.version.Version;
Expand Down Expand Up @@ -161,7 +160,7 @@ private Collection<Version> bootVersions() {
.stream()
.map(DefaultMetadataElement::getId)
.map(VersionParser.DEFAULT::parse)
.collect(Collectors.toList());
.toList();
}

private Collection<DependencyGroup> groups() {
Expand All @@ -172,7 +171,7 @@ private Collection<Dependency> dependenciesForBootVersion(DependencyGroup group,
return group.getContent()
.stream()
.filter((dependency) -> dependency.match(bootVersion))
.collect(Collectors.toList());
.toList();
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,6 @@

import java.util.Arrays;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import io.spring.initializr.generator.buildsystem.Build;
import io.spring.initializr.generator.buildsystem.Dependency;
Expand All @@ -33,6 +32,7 @@
* @author Andy Wilkinson
* @author Yonghui Ye
* @author Stephane Nicoll
* @author Eddú Meléndez
*/
abstract class SpringAzureModuleRegistry {

Expand All @@ -55,7 +55,7 @@ static Iterable<ImplicitDependency> createSpringBootRegistry() {
}

private static Iterable<ImplicitDependency> create(ImplicitDependency.Builder... dependencies) {
return Arrays.stream(dependencies).map(Builder::build).collect(Collectors.toList());
return Arrays.stream(dependencies).map(Builder::build).toList();
}

private static ImplicitDependency.Builder onDependencies(String... dependencyIds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import io.spring.initializr.generator.buildsystem.Build;
import io.spring.initializr.generator.buildsystem.Dependency;
Expand All @@ -37,6 +36,7 @@
* @author Artem Bilan
* @author Stephane Nicoll
* @author Moritz Halbritter
* @author Eddú Meléndez
*/
abstract class SpringIntegrationModuleRegistry {

Expand Down Expand Up @@ -86,7 +86,7 @@ static Iterable<ImplicitDependency> create(Version platformVersion) {
.andThen(addReferenceLink("WebSocket Module", "web-sockets"))));
builders.add(onDependencies("web-services").customizeBuild(addDependency("ws"))
.customizeHelpDocument(addReferenceLink("Web Services Module", "ws")));
return builders.stream().map(Builder::build).collect(Collectors.toList());
return builders.stream().map(Builder::build).toList();
}

private static ImplicitDependency.Builder onDependencies(String... dependencyIds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import io.spring.initializr.generator.buildsystem.Build;
import io.spring.initializr.generator.buildsystem.Dependency;
Expand Down Expand Up @@ -102,7 +101,7 @@ static Iterable<ImplicitDependency> create(Version platformVersion) {
builders.add(onDependencies("spring-ai-vectordb-weaviate").customizeBuild(addModule("weaviate"))
.customizeHelpDocument(addReferenceLink("Weaviate Module", "testcontainers/")));
}
return builders.stream().map(Builder::build).collect(Collectors.toList());
return builders.stream().map(Builder::build).toList();
}

private static ImplicitDependency.Builder onDependencies(String... dependencyIds) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,6 @@
package io.spring.start.site.support;

import java.util.List;
import java.util.stream.Collectors;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.spring.initializr.generator.version.Version;
Expand All @@ -33,6 +32,7 @@
*
* @author Stephane Nicoll
* @author Moritz Halbritter
* @author Eddú Meléndez
*/
public class StartInitializrMetadataUpdateStrategy extends SpringIoInitializrMetadataUpdateStrategy {

Expand All @@ -45,8 +45,7 @@ public StartInitializrMetadataUpdateStrategy(RestTemplate restTemplate, ObjectMa
@Override
protected List<DefaultMetadataElement> fetchSpringBootVersions(String url) {
List<DefaultMetadataElement> versions = super.fetchSpringBootVersions(url);
return (versions != null) ? versions.stream().filter(this::isCompatibleVersion).collect(Collectors.toList())
: null;
return (versions != null) ? versions.stream().filter(this::isCompatibleVersion).toList() : null;
}

private boolean isCompatibleVersion(DefaultMetadataElement versionMetadata) {
Expand Down

0 comments on commit 0f613bb

Please sign in to comment.