X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=inline;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Futil%2FHierarchyMultiMap.java;h=b12d5ad2b9b4ab9d2f7d74733a2ebfe1fae21b71;hb=refs%2Fchanges%2F07%2F4307%2F3;hp=a4ac87b50d1472d02626647145e6c412905aa7b6;hpb=07710b8d5004ddfc203ff18a2c3f7a361f952c52;p=simantics%2Fplatform.git
diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/HierarchyMultiMap.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/HierarchyMultiMap.java
index a4ac87b50..b12d5ad2b 100644
--- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/HierarchyMultiMap.java
+++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/HierarchyMultiMap.java
@@ -37,7 +37,28 @@ public abstract class HierarchyMultiMap {
bs.add(b);
cache = null;
}
-
+
+ /**
+ * Appends the contents of the specified map to this map.
+ *
+ * @param from the map to append contents from
+ */
+ public void append(HierarchyMultiMap from) {
+ from.appendTo(this);
+ }
+
+ /**
+ * Appends the contents of this map to the specified map.
+ *
+ * @param to the map to append to
+ */
+ public void appendTo(HierarchyMultiMap to) {
+ map.forEachEntry((a, bl) -> {
+ bl.forEach(b -> to.put(a, b));
+ return true;
+ });
+ }
+
/**
* Gets the values stored into the map for the key {@code a} or
* its superelements.