X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Futil%2FHierarchyMultiMap.java;h=b12d5ad2b9b4ab9d2f7d74733a2ebfe1fae21b71;hp=a4ac87b50d1472d02626647145e6c412905aa7b6;hb=b0f9786319a4d10f49723ad3ae755ae72bc39f67;hpb=21bef5bfa30007c081028f4f40d52a20c43794ca 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.