RFR: JDK-8170945: Collectors$Partition should override more Map methods

Stuart Marks smarks at openjdk.org
Tue Apr 11 17:24:35 UTC 2023


On Wed, 5 Apr 2023 09:19:57 GMT, Viktor Klang <duke at openjdk.org> wrote:

> Adds overrides for common Map operations to avoid having to allocate the entrySet for Collectors$Partition maps.

OK, the change is probably good, including removal of the `booleanValue` call. I'm not sure `containsKey` and `containsValue` are worth it, but they're just one-liners. The `entrySet` method could be simplified, but at a cost of a small change in behavior, maybe not worth fiddling with given the low usage. The main benefit here is `get` (contrary to some suggestions I had made six years ago in the bug report).

-------------

Marked as reviewed by smarks (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13347#pullrequestreview-1379762188


More information about the core-libs-dev mailing list