You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2020/05/07 20:18:25 UTC

[maven] 02/02: [MNG-5600] Small refactor

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MNG-5600-sl
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 2dc7c03bf1f79857cbf99389da9d0d83854d559c
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Thu May 7 22:18:08 2020 +0200

    [MNG-5600] Small refactor
---
 .../maven/model/building/DefaultModelBuilder.java   | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index 092fdb2..2a2adeb 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -1415,20 +1415,13 @@ public class DefaultModelBuilder
                     {
                         if ( exclusion.getGroupId() != null && exclusion.getArtifactId() != null )
                         {
-                            for ( final Iterator<Dependency> dependencies = importMgmt.getDependencies().iterator();
-                                dependencies.hasNext(); )
-                            {
-                                final Dependency candidate = dependencies.next();
-
-                                if ( ( exclusion.getGroupId().equals( "*" )
-                                    || exclusion.getGroupId().equals( candidate.getGroupId() ) )
-                                    && ( exclusion.getArtifactId().equals( "*" )
-                                    || exclusion.getArtifactId().equals( candidate.getArtifactId() ) ) )
-                                {
-                                    // Dependency excluded from import.
-                                    dependencies.remove();
-                                }
-                            }
+                            // Dependency excluded from import.
+                            importMgmt.getDependencies()
+                                    .removeIf( candidate -> (
+                                            exclusion.getGroupId().equals( "*" ) ||
+                                                    exclusion.getGroupId().equals( candidate.getGroupId() ) )
+                                            && ( exclusion.getArtifactId().equals( "*" ) ||
+                                                    exclusion.getArtifactId().equals( candidate.getArtifactId() ) ) );
                         }
                     }