Lisker
Sent: Monday, 28 April 2025 13:21
To: Viktor Klang
Cc: core-libs-dev@openjdk.org
Subject: [External] : Re: Casting gatherer
Hi Viktor,
stream.filter(myClass:isInstance).map(myClass:cast)
is indeed the current way of doing it. I've written this code many times and I
suspect others
Java Platform Group
> Oracle
> --
> *From:* core-libs-dev on behalf of Nir
> Lisker
> *Sent:* Saturday, 26 April 2025 20:55
> *To:* core-libs-dev@openjdk.org
> *Subject:* Casting gatherer
>
> Hi,
>
> instanceof has been refitted to incl
@openjdk.org
Subject: Casting gatherer
Hi,
instanceof has been refitted to include an auto-cast ("pattern matching on
instanceof"). Unfortunately, doing this as an intermediate operation on a
stream requires first to filter via instanceof and then map via a cast. This is
because
x
April 26, 2025 3:22 PM
To: Chen Liang
Cc: Nir Lisker ; core-libs-dev@openjdk.org
; amber-dev
Subject: [External] : Re: Casting gatherer
Didn't Brian or one of the Amber folks say that we might (some time in the near
future) get a .match() method on streams, which can take in a pattern
s-dev on behalf of Nir
> Lisker
> *Sent:* Saturday, April 26, 2025 1:55 PM
> *To:* core-libs-dev@openjdk.org
> *Subject:* Casting gatherer
>
> Hi,
>
> instanceof has been refitted to include an auto-cast ("pattern matching on
> instanceof"). Unfortunately, do
isker
Sent: Saturday, April 26, 2025 1:55 PM
To: core-libs-dev@openjdk.org
Subject: Casting gatherer
Hi,
instanceof has been refitted to include an auto-cast ("pattern matching on
instanceof"). Unfortunately, doing this as an intermediate operation on a
stream requires first to filter v
Hi,
instanceof has been refitted to include an auto-cast ("pattern matching on
instanceof"). Unfortunately, doing this as an intermediate operation on a
stream requires first to filter via instanceof and then map via a cast.
This is because
x instanceof MyClass myClass
returns a boolean, not