-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flow<*>.filterIsInstance is missing its Class<R> overload #3240
Comments
This is indeed a pretty simple extension. Could you please elaborate on whether you have an actual use-case for Class-based filtering or just would like to see the API aligned with Collection API? Could you please elaborate on your use-case? |
I would like it fixed for both real life use cases and consistency. I mostly implement protocols for communication applications (like XMPP). What ends up happening is that there are a lot of features that only listen to one type of message. So I usually end up writing a helper function to only get the message you want. It also ends up being more type safe, because I specify the inheritance of the generic parameter. If you just use
|
Implemented in #3464 |
Our workflow is different: a bot closes the issues automatically once the fixes are part of a release. |
Some sort of wizardry! Sorry 😅 |
Yeah, it's kinda bummer from the maintenance perspective, but it is more transparent for users -- our |
Hurray! |
The Kotlin stdlib provides
filterIsInstance
for Array and Iterable with an inline and non inline version (aka with Class). Flow does not include the Class version. This seems inconsistent and that Flow should add a variant that takes the Class. I have encountered this myself and ended up writing my ownfilterIsInstance
to do just that.The text was updated successfully, but these errors were encountered: