Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6268068

(coll) PriorityQueue.remove(Object) should use equals, not its ordering, to find element to remove

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 6
    • core-libs
    • b51
    • generic
    • generic
    • Verified

      PriorityQueue.remove(Object) uses its ordering, that is,
      either (Comparable)o.compareTo(e), or comparator.compare(o,e).

      Instead it should use o.equals(e)... because:

      - that's what the base interface Collection.remove(Object) spec says
      - the implementation throws ClassCastException, but the spec does not
        mention this exception.
      - remove(Object) should be consistent with contains(Object), i.e.
        remove(Object) should be able to find an element to remove iff
        contains(Object) is able to find it. remove(Object) should be
        implemented in terms of equals iff contains(Object) is.

      ###@###.### 2005-05-10 17:43:47 GMT

            martin Martin Buchholz
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: