paulk-asert commented on code in PR #665:
URL:
https://github.com/apache/commons-collections/pull/665#discussion_r2618867244
##########
src/main/java/org/apache/commons/collections4/MultiMapUtils.java:
##########
@@ -170,6 +171,27 @@ public static boolean isEmpty(final MultiValuedMap<?, ?>
map) {
return map == null || map.isEmpty();
}
+ /**
+ * A utility method to invert the mappings from a source MultiValuedMap
+ * to a collector MultiValuedMap. If you are trying to create an
+ * inverse multimap of the same kind as the original, consider using
+ * {@link MultiValuedMap#inverted()}.
+ *
+ * @param source take key-to-value mappings from here
+ * @param dest add value-to-key mappings here
+ * @param <K> the dest key type
+ * @param <V> the dest value type
+ * @param <M> the dest multimap
+ * @return the destination
Review Comment:
The utility method doesn't create a new multimap but stores inverted
mappings in the supplied collector (destination) which is also returned. The
`inverted` method implementations supply a new multimap as the collector, but
it doesn't need to be the same type or be new (to allow aggregation) when using
the utility method. I could try to use "collector" everywhere and avoid
"destination" if you think that would be clearer?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]