JDK-8250842 : Release Note: Specialized Implementations of TreeMap Methods
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.util:collections
  • Affected Version: 15
  • Priority: P4
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2020-07-30
  • Updated: 2021-05-14
  • Resolved: 2020-08-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 15
15Resolved
Description
The TreeMap class now provides overriding implementations of the `putIfAbsent`, `computeIfAbsent`, `computeIfPresent`, `compute`, and `merge` methods. The new implementations provide a performance improvement. However, if the function provided to the `compute-` or `merge` methods modifies the map, ConcurrentModificationException may be thrown, because the function that is provided to these methods is prohibited from modifying the map. If a ConcurrentModificationException occurs, the function must either be changed to avoid modifying the map, or the surrounding code should be rewritten to replace uses of the `compute-` and `merge` methods with conventional Map methods such as `get` and `put`.

See JDK-8227666 for further information.