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

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

Robert Wertman created COLLECTIONS-709:
------------------------------------------

             Summary: 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.2, 4.1
            Reporter: Robert Wertman


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)