On Tue, 21 Mar 2023 15:23:53 GMT, Claes Redestad <redes...@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