garydgregory commented on code in PR #703:
URL:
https://github.com/apache/commons-collections/pull/703#discussion_r3535938711
##########
src/main/java/org/apache/commons/collections4/Bag.java:
##########
@@ -40,8 +40,34 @@
* In an ideal world, the interface would be changed to fix the problems,
however
* it has been decided to maintain backwards compatibility instead.
* </p>
+ * <p>
+ * The {@link MultiSet} interface, added in version 4.1, provides the same
+ * functionality while complying with the {@link Collection} contract, and
+ * should be preferred for new code. Existing code can migrate as follows,
+ * with the cardinality-respecting behavior preserved through explicitly
+ * named methods:
+ * </p>
+ * <ul>
+ * <li>{@code bag.add(e)} becomes {@code multiSet.add(e)}
+ * (which always returns {@code true}, per the {@code Collection}
contract)</li>
Review Comment:
Hello @paulk-asert
The Collection contract says:
```java
* @return {@code true} if this collection changed as a result of the
* call
```
Which is not what this Javadoc says. Shouldn't the reference here be to
`MultiSet.add(E)` instead of `Collection.add(E)`? Or clarify it somehow...
--
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]