You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2019/01/20 15:07:00 UTC

[jira] [Resolved] (COLLECTIONS-709) MultiSet.Entry::getCount() isn't 0 after removing the last element

     [ https://issues.apache.org/jira/browse/COLLECTIONS-709?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory resolved COLLECTIONS-709.
--------------------------------------
       Resolution: Fixed
    Fix Version/s: 4.3

In git master now. Please verify and close this ticket and the PR.

> MultiSet.Entry::getCount() isn't 0 after removing the last element
> ------------------------------------------------------------------
>
>                 Key: COLLECTIONS-709
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-709
>             Project: Commons Collections
>          Issue Type: Bug
>    Affects Versions: 4.1, 4.2
>            Reporter: Robert Wertman
>            Priority: Minor
>             Fix For: 4.3
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Removing the final element(s) in a MultiSet doesn't set the count on a MultiSet.Entry to zero.
> {code:java}
> protected int getCountAfterRemoval(MultiSet<String> multiset) {
>   MultiSet.Entry<String> entry = multiset.entrySet().iterator().next();
>   entry.getCount(); // = 2
>   multiset.remove(entry.getElement());
>   entry.getCount(); // = 1
>   multiset.remove(entry.getElement());
>   return entry.getCount(); // Still = 1, should be 0
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)