rootvector2 commented on PR #701: URL: https://github.com/apache/commons-collections/pull/701#issuecomment-4878346839
The removal behavior is unchanged and still follows the contract. `uniqueSet()` and `entrySet()` removal drops the whole entry (all occurrences of the element), exactly as before. The patch only fixes the cached `size` field, which those two view iterators never decremented. That left `size()` reporting `N` while `isEmpty()` returned `true` and `toArray()` (sized by `size()`) came back with `N` trailing nulls, so `size()` was inconsistent with the other views. Found it comparing this class against `AbstractMapBag`, whose bag iterator already adjusts `size`. On testing: moved the regression test up into `AbstractMultiSetTest` so it runs for every concrete implementation (`HashMultiSet`, `PredicatedMultiSet`, `SynchronizedMultiSet`; skipped for `UnmodifiableMultiSet`, which does not support removal) instead of just `HashMultiSet`. -- 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]
