TreeMap specific override of putIfAbsent/merge

Tomasz Kowalczewski tomasz.kowalczewski at gmail.com
Fri May 20 13:19:25 UTC 2016


Hi all,

TreeMap does not have its own specific overrides of Map methods that were
added in java 8. In our specific usage we do what is effective a merge
operation:

For incoming K and V:
1. get value from map
2. if present - merge with incoming value V
3. if absent - associate K with V in the map

For case where K is not in the map we traverse the tree map it twice.
Implementing TreeMap specific override of putIfAbsent would allow as to
avoid this cost.

Was such change considered in past and rejected? Is anyone interested in a
patch that implements it?

-- 
Regards,
Tomasz Kowalczewski



More information about the core-libs-dev mailing list