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

wasted work in AbstractMapBag.containsAll()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.1
    • 4.0-alpha1, 4.0
    • Bag
    • any

    Description

      The problem appears in version 3.2.1 and in revision 1489197. I
      attached a one-line patch that fixes it.

      In method "AbstractMapBag.containsAll", the loop over
      "other.uniqueSet()" should return immediately after "result" becomes
      "false", because "result = result && contains;" can never become
      "true" again. All the iterations after "result" becomes "false" do
      not perform any useful work, at best they just set "result" again to
      "false".

      Attachments

        1. patch.diff
          0.6 kB
          Adrian Nistor

        Activity

          People

            Unassigned Unassigned
            adriannistor Adrian Nistor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: