You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2023/02/10 21:41:00 UTC
[jira] [Closed] (GROOVY-10696) The DGM removeAll variants which take a closure can be refactored to use removeIf for better efficiency
[ https://issues.apache.org/jira/browse/GROOVY-10696?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-10696.
------------------------------
> The DGM removeAll variants which take a closure can be refactored to use removeIf for better efficiency
> -------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-10696
> URL: https://issues.apache.org/jira/browse/GROOVY-10696
> Project: Groovy
> Issue Type: Improvement
> Components: groovy-jdk
> Reporter: Paul King
> Assignee: Paul King
> Priority: Major
> Fix For: 4.0.5
>
>
> We'd want all of the normal variations to work unchanged:
> {code}
> def list = ['a', 'b']
> list.removeAll { it == 'b' }
> assert list == ['a']
> def m1 = [a:1, b:2]
> m1.removeAll { k,v -> k == 'b' }
> assert m1 == [a:1]
> def m2 = [a:1, b:2]
> m2.removeAll { k,v -> v == 1 }
> assert m2 == [b:2]
> def m3 = [a:1, b:2]
> m3.removeAll { e -> e.key == 'b' }
> assert m3 == [a:1]
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)