RFR: 8302818: Optimize wrapper sets and immutable sets of Enums [v5]
Pavel Rappo
prappo at openjdk.org
Tue Mar 21 16:58:32 UTC 2023
On Tue, 21 Mar 2023 15:23:53 GMT, Claes Redestad <redestad at openjdk.org> wrote:
> An alternative design which would avoid adding more classes could be to add package-private accessors to the existing `Unmodifiable/Synchronized` wrapper classes so that `EnumSet/-Map` can retrieve the underlying set of an unmodifiable or synchronized `Set` or `Map` and then use it directly for these bulk operations. Then you'd contain the additional overhead to `EnumSet/-Map`.
Another alternative, in cases where `arg.getClass() == X.class` can be safely substituted with `requireNonNull(arg) instanceof X`, is a marker interface.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/12498#issuecomment-1478253385
More information about the core-libs-dev
mailing list