Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-709

MultiSet.Entry::getCount() isn't 0 after removing the last element

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.1, 4.2
    • 4.3
    • None
    • None

    Description

      Removing the final element(s) in a MultiSet doesn't set the count on a MultiSet.Entry to zero.

      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
      }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              CasualSuperman Robert Wertman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h