Skip to content

Commit 15e122c

Browse files
author
Vincent Potucek
committed
Issue #17487: Apply StreamRulesRecipes
- checkstyle/checkstyle#17782
1 parent 60fbfb4 commit 15e122c

File tree

6 files changed

+8
-20
lines changed

6 files changed

+8
-20
lines changed

compat/maven-compat/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,7 @@ public ResolutionGroup retrieve(MetadataResolutionRequest request) throws Artifa
202202
if (session != null) {
203203
if (session.getProjects() != null) {
204204
pomRepositories = session.getProjects().stream()
205-
.filter(p -> artifact.equals(p.getArtifact()))
206-
.map(MavenProject::getRemoteArtifactRepositories)
207-
.findFirst()
205+
.filter(p -> artifact.equals(p.getArtifact())).findFirst().map(MavenProject::getRemoteArtifactRepositories)
208206
.orElseGet(() -> getRepositoriesFromModel(repositorySession, model));
209207
} else {
210208
pomRepositories = getRepositoriesFromModel(repositorySession, model);

impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/CompatibilityFixStrategy.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,7 @@ private Path findParentPomInMap(
533533
&& Objects.equals(gav.groupId(), groupId)
534534
&& Objects.equals(gav.artifactId(), artifactId)
535535
&& (version == null || Objects.equals(gav.version(), version));
536-
})
537-
.map(Map.Entry::getKey)
538-
.findFirst()
536+
}).findFirst().map(Map.Entry::getKey)
539537
.orElse(null);
540538
}
541539

impl/maven-di/src/main/java/org/apache/maven/di/impl/InjectorImpl.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,7 @@ protected <Q> Supplier<Q> compile(Binding<Q> binding) {
278278
Supplier<Q> compiled = binding.compile(this::getCompiledBinding);
279279
if (binding.getScope() != null) {
280280
Scope scope = scopes.entrySet().stream()
281-
.filter(e -> e.getKey().isInstance(binding.getScope()))
282-
.map(Map.Entry::getValue)
283-
.findFirst()
281+
.filter(e -> e.getKey().isInstance(binding.getScope())).findFirst().map(Map.Entry::getValue)
284282
.orElseThrow(() -> new DIException("Scope not bound for annotation "
285283
+ binding.getScope().annotationType()))
286284
.get();

impl/maven-testing/src/main/java/org/apache/maven/api/plugin/testing/MojoExtension.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,7 @@ public Object resolveParameter(ParameterContext parameterContext, ExtensionConte
264264

265265
XmlNode pluginConfiguration = model.getBuild().getPlugins().stream()
266266
.filter(p ->
267-
Objects.equals(p.getGroupId(), coord[0]) && Objects.equals(p.getArtifactId(), coord[1]))
268-
.map(ConfigurationContainer::getConfiguration)
269-
.findFirst()
267+
Objects.equals(p.getGroupId(), coord[0]) && Objects.equals(p.getArtifactId(), coord[1])).findFirst().map(ConfigurationContainer::getConfiguration)
270268
.orElseGet(() -> XmlNode.newInstance("config"));
271269
List<XmlNode> children = mojoParameters.stream()
272270
.map(mp -> XmlNode.newInstance(mp.name(), mp.value()))

impl/maven-xml/src/main/java/org/apache/maven/internal/xml/DefaultXmlService.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,9 @@ public XmlNode doMerge(XmlNode dominant, XmlNode recessive, Boolean childMergeOv
311311
String name = recessiveChild.name();
312312
Iterator<XmlNode> it =
313313
commonChildren.computeIfAbsent(name, n1 -> Stream.of(dominant.children().stream()
314-
.filter(n2 -> n2.name().equals(n1))
315-
.collect(Collectors.toList()))
316-
.filter(l -> !l.isEmpty())
317-
.map(List::iterator)
318-
.findFirst()
314+
.filter(n2 -> n2.name().equals(n1))
315+
.collect(Collectors.toList()))
316+
.filter(l -> !l.isEmpty()).findFirst().map(List::iterator)
319317
.orElse(null));
320318
if (it == null) {
321319
if (children == null) {

its/core-it-support/maven-it-helper/src/main/java/org/apache/maven/it/Verifier.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@ public void execute() throws VerificationException {
195195
String outerHead = outerLocalRepository.toString();
196196

197197
String itTail = args.stream()
198-
.filter(s -> s.startsWith("-Dmaven.repo.local.tail="))
199-
.map(s -> s.substring(24).trim())
200-
.findFirst()
198+
.filter(s -> s.startsWith("-Dmaven.repo.local.tail=")).findFirst().map(s -> s.substring(24).trim())
201199
.orElse("");
202200
if (!itTail.isEmpty()) {
203201
// remove it

0 commit comments

Comments
 (0)