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<A,B> 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<A,B> 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.