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
Override Java 8 default method Collection#removeIf #1432
Comments
Thanks for volunteering @aqsa505. I assigned the issue to you. |
Can I try to solve the issue if it is open. |
Hi, there seems no progress on this. Can I work on this @donraab ? |
The challenge with this issue is what exactly to do. I'm going to share some thoughts here @aqsa505 to hopefully make this easier to approach. The
There is an additional
The
I believe Eclipse Collections has had Proposal: I think we should just remove the EC overload of I would like to hear thoughts from the other committers @motlin @nikhilnanivadekar @prathasirisha @mohrezaei on this proposal. |
hmmm... Not a fan of the proposal. There are at least two other options:
|
Thanks Moh. I think option 1 is fine, and should be easy enough to implement. I think option 2 would be hard to do. The reason I was suggesting removing overload on I tried the code below and was surprised there wasn't an ambiguity problem with using a lambda. I'm guessing it might be because EC Predicate extends JDK Predicate, and the more specific
I was surprised the lambda didn't require a cast, although casting does work and calls the implementation on
|
This blog:
***@***.***/eclipse-collections-10-4-0-released-7c5b3f43c0f0
And more specifically this blog:
https://stuartmarks.wordpress.com/2020/09/22/incompatibilities-with-jdk-15-charsequence-isempty/
covers the reasons that can cause ambiguity thus clarifying why this is not
ambiguous.
…On Mon, Apr 17, 2023 at 7:22 AM Donald Raab ***@***.***> wrote:
Thanks Moh. I think option 1 is fine, and should be easy enough to
implement. I think option 2 would be hard to do. The reason I was
suggesting removing ours is that it might be confusing to developers having
two removeIfs defined, but then again this has been the case already for
the past 8 years since Java 8 was released.
I tried the code below and was surprised there wasn't an ambiguity problem
with using a lambda. I'm guessing it might be because EC Predicate extends
JDK Predicate, and the more specific removeIf on MutableCollection is
chosen.
@test
public void removeIf()
{
MutableList<Integer> list = Lists.mutable.with(1, 2, 3);
list.removeIf(each -> each % 2 == 0);
Assertions.assertEquals(Lists.mutable.with(1, 3), list);
}
I was surprised the lambda didn't require a cast, although casting does
work and calls the implementation on Collection.
@test
public void removeIf()
{
MutableList<Integer> list = Lists.mutable.with(1, 2, 3);
list.removeIf((java.util.function.Predicate<Integer>) (each -> each % 2 == 0));
Assertions.assertEquals(Lists.mutable.with(1, 3), list);
}
—
Reply to this email directly, view it on GitHub
<#1432 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACLY4XITAC46DAO6Y2FVRCDXBSO7DANCNFSM6AAAAAAUS56E3Y>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I tried option 2. Documenting here for posterity.
|
Ok, @aqsa505 I think you can go ahead with option 1 from @mohrezaei . Just override the JDK method in |
Hi @donraab I would like to take this up, if nobody is working on it now |
Thanks for volunteering @aditya-32. It is assigned currently to @aqsa505. I'll wait for her to comment whether she is working on it currently. |
As mentioned in #500, the
Collection#removeIf
has not been overridden in Eclipse Collection yet.I would like to work on that!
The text was updated successfully, but these errors were encountered: