-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
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.
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.