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

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new fe76cdb  Add utility method to CollectionHelper
fe76cdb is described below

commit fe76cdbba478488aedb15465553014dc09f1a470
Author: lburgazzoli <[email protected]>
AuthorDate: Thu May 14 23:03:41 2020 +0200

    Add utility method to CollectionHelper
---
 .../java/org/apache/camel/util/CollectionHelper.java   | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git 
a/core/camel-util/src/main/java/org/apache/camel/util/CollectionHelper.java 
b/core/camel-util/src/main/java/org/apache/camel/util/CollectionHelper.java
index ef9d5d1..531ed11 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/CollectionHelper.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/CollectionHelper.java
@@ -222,4 +222,22 @@ public final class CollectionHelper {
 
         return properties;
     }
+
+    /**
+     * Build a new map that is the result of merging the given list of maps.
+     */
+    @SafeVarargs
+    public static <K, V> Map<K, V> mergeMaps(Map<K, V> map, Map<K, V>... maps) 
{
+        Map<K, V> answer = new HashMap<>();
+
+        if (map != null) {
+            answer.putAll(map);
+        }
+
+        for (Map<K, V> m : maps) {
+            answer.putAll(m);
+        }
+
+        return answer;
+    }
 }

Reply via email to