You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/07/16 16:16:25 UTC
[commons-configuration] 03/10: Use forEach()
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-configuration.git
commit 79290904a0c9491ace93992463b83ed073e55706
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jul 16 12:15:15 2022 -0400
Use forEach()
---
.../configuration2/builder/BasicBuilderParameters.java | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/commons/configuration2/builder/BasicBuilderParameters.java b/src/main/java/org/apache/commons/configuration2/builder/BasicBuilderParameters.java
index c8482255..8b6833fe 100644
--- a/src/main/java/org/apache/commons/configuration2/builder/BasicBuilderParameters.java
+++ b/src/main/java/org/apache/commons/configuration2/builder/BasicBuilderParameters.java
@@ -242,11 +242,11 @@ public class BasicBuilderParameters implements Cloneable, BuilderParameters, Bas
throw new IllegalArgumentException("Parameters to merge must not be null!");
}
- for (final Map.Entry<String, Object> e : p.getParameters().entrySet()) {
+ p.getParameters().entrySet().forEach(e -> {
if (!properties.containsKey(e.getKey()) && !e.getKey().startsWith(RESERVED_PARAMETER_PREFIX)) {
storeProperty(e.getKey(), e.getValue());
}
- }
+ });
}
/**
@@ -423,11 +423,11 @@ public class BasicBuilderParameters implements Cloneable, BuilderParameters, Bas
return null;
}
- for (final Map.Entry<?, ?> e : prefixes.entrySet()) {
+ prefixes.entrySet().forEach(e -> {
if (!(e.getKey() instanceof String) || !(e.getValue() instanceof Lookup)) {
throw new IllegalArgumentException("Map with prefix lookups contains invalid data: " + prefixes);
}
- }
+ });
return fetchPrefixLookups(params);
}
@@ -460,10 +460,8 @@ public class BasicBuilderParameters implements Cloneable, BuilderParameters, Bas
return null;
}
- for (final Object o : col) {
- if (!(o instanceof Lookup)) {
- throw new IllegalArgumentException("Collection with default lookups contains invalid data: " + col);
- }
+ if (col.stream().noneMatch(o -> o instanceof Lookup)) {
+ throw new IllegalArgumentException("Collection with default lookups contains invalid data: " + col);
}
return fetchDefaultLookups(params);
}