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

TreeMap code could be simplified substantially

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • core-libs
    • None
    • beta2
    • generic
    • generic
    • Verified

      As you may know, the reason that links and colors are swapped instead of
      elements is for the sake of iterators. That is also the reason that the
      Standard Template Library's erase method swaps links and colors instead of
      elements. This approach is necessary in C++. But in the Java Collections
      Framework, if the deleteEntry method is called from the TreeMap's remove
      method, any iterators will be invalidated anyway, so there is no harm in
      swapping elements. And if the deleteEntry method is called by the remove
      method in the embedded Iterator class, it is relatively easy to ensure that
      the "next" reference is properly positioned.

            jjb Josh Bloch (Inactive)
            jjb Josh Bloch (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: