On Tue, 23 Apr 2024 09:17:29 GMT, Per Minborg <pminb...@openjdk.org> wrote:
>> src/java.base/share/classes/java/util/ImmutableCollections.java line 183: >> >>> 181: K key, >>> 182: Function<? super K, ? >>> extends V> mapper) { >>> 183: if (map instanceof HasComputeIfUnset) { >> >> Can we use pattern matching instanceof here? >> >> if (map instance HasComputeIfUnset uc) { > > Good idea. Ahh. I thought you meant pattern matching in another place (which actually turned out to be a really good idea). Here, however, we also need to get the type parameters correct: <img width="926" alt="image" src="https://github.com/openjdk/jdk/assets/7457876/b2a66033-4c74-42bc-a9de-a976c441ca61"> ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18794#discussion_r1576154547