-
Notifications
You must be signed in to change notification settings - Fork 731
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
Fix crash on API <24 and make sure this error will not occur again. #4962
Conversation
54a2fcf
to
8f30e84
Compare
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | ||
removeIf(predicate) | ||
} else { | ||
removeAll(filter(predicate).toSet()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been asked to convert to Set for performance reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as this is only for the keys to remove there shouldn't be any changes for lists with duplicated items?
listOf(1, 1, 2).removeIfCompat { it == 2 } // would still expect [1, 1]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that you say it, I am not sure what will happen with
listOf(1, 1, 2).removeIfCompat { it == 1 } // would still expect [2] but I think we will get [1, 2]
Let me play a bit with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work as expected:
(https://pl.kotl.in/vIVLDMXe-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for checking!
@@ -40,6 +40,7 @@ | |||
<issue id="RtlSymmetry" severity="error" /> | |||
|
|||
<!-- Code --> | |||
<issue id="NewApi" severity="error" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
Matrix SDKIntegration Tests Results:
|
Now included in #4971 |
Fix crash on API <24 and make sure this error will not occur again.