Use lambdas for map entry iteration where possible

See gh-12626
This commit is contained in:
igor-suhorukov
2018-03-24 09:19:03 +03:00
committed by Phillip Webb
parent 78a94cafe1
commit 69bc19e0ca
31 changed files with 125 additions and 232 deletions

View File

@@ -20,7 +20,6 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -423,14 +422,7 @@ class ProjectGenerationRequest {
private static void filter(Map<String, ProjectType> projects, String tag,
String tagValue) {
for (Iterator<Map.Entry<String, ProjectType>> it = projects.entrySet()
.iterator(); it.hasNext();) {
Map.Entry<String, ProjectType> entry = it.next();
String value = entry.getValue().getTags().get(tag);
if (!tagValue.equals(value)) {
it.remove();
}
}
projects.entrySet().removeIf((entry) -> !tagValue.equals(entry.getValue().getTags().get(tag)));
}
}

View File

@@ -19,7 +19,6 @@ package org.springframework.boot.cli.compiler;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.codehaus.groovy.ast.ASTNode;
@@ -68,14 +67,8 @@ public abstract class AnnotatedNodeASTTransformation implements ASTTransformatio
for (ImportNode importNode : module.getStarImports()) {
visitAnnotatedNode(importNode, annotationNodes);
}
for (Map.Entry<String, ImportNode> entry : module.getStaticImports()
.entrySet()) {
visitAnnotatedNode(entry.getValue(), annotationNodes);
}
for (Map.Entry<String, ImportNode> entry : module.getStaticStarImports()
.entrySet()) {
visitAnnotatedNode(entry.getValue(), annotationNodes);
}
module.getStaticImports().forEach((key, value) -> visitAnnotatedNode(value, annotationNodes));
module.getStaticStarImports().forEach((key, value) -> visitAnnotatedNode(value, annotationNodes));
for (ClassNode classNode : module.getClasses()) {
visitAnnotatedNode(classNode, annotationNodes);
classNode.visitContents(classVisitor);