Re: [External] : Re: Casting gatherer

2025-04-28 Thread Viktor Klang
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

Re: Casting gatherer

2025-04-28 Thread Nir Lisker
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

Re: Casting gatherer

2025-04-28 Thread Viktor Klang
@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

Re: [External] : Re: Casting gatherer

2025-04-26 Thread Chen Liang
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

Re: Casting gatherer

2025-04-26 Thread David Alayachew
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

Re: Casting gatherer

2025-04-26 Thread Chen Liang
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

Casting gatherer

2025-04-26 Thread Nir Lisker
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