|
So we *shouldn't* mutate the keys, but what if we do anyway? Can the
tree become corrupted?
I think it's just like using a Java Map.
You can put any object in it as key as long as it supports the compareTo
method (defined at Object).
When you add a key/item pair the key will be inserted inbetween the other
keys in the right order.
This order won't change; it's fixed.
So if you change the key in some way which affects the sorting order, the
sorting order won't reflect the position in the map. So yes, then it's
corrupt. You just should not do that, the same with Java.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.