How TreeMap does what it does.
I just tried to use the new version of TreeMap. Frustrated until I figured out that value V is a shallow copy. In my example, the problem cleared up when I used a different explicitly constructed iterator. In the same example, keyword K was a string literal inside each TreeMap.put(). This is not the way I will use in my intended "real" program. Is Keyword K also a shallow copy?
TIA,
Re: How TreeMap does what it does.
Map's don't hold copies, they hold references to the objects placed within the Map. I recommend you post an SSCCE demonstrating the problem you are experiencing and the behavior you want to shed more light on the subject.
Re: How TreeMap does what it does.
The 'new version' of TreeMap?