From dfcf1d77a65344934f0e642907819f16b5a3af0a Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Sat, 26 Jun 2021 09:23:41 +0700 Subject: [PATCH] AjBuildConfig: simplify null classpath removal from path list Use removeIf(Objects::isNull) instead of old-fashioned iterator loop. Signed-off-by: Alexander Kriegisch --- .../ajdt/internal/core/builder/AjBuildConfig.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java index 5279ad940..91ca329c9 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java @@ -23,9 +23,9 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.StringTokenizer; import java.util.stream.Collectors; @@ -957,12 +957,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { // The classpath is done after modules to give precedence to modules that share the // same paths as classpath elements (the upcoming normalize will remove later dups) allPaths.addAll(processStringPath(classpath, encoding)); - for (Iterator iter = allPaths.iterator();iter.hasNext();) { - Classpath next = iter.next(); - if (next == null) { - iter.remove(); - } - } + allPaths.removeIf(Objects::isNull); allPaths = FileSystem.ClasspathNormalizer.normalize(allPaths); this.checkedClasspaths = new FileSystem.Classpath[allPaths.size()]; allPaths.toArray(this.checkedClasspaths); -- 2.39.5