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 2020/01/27 10:05:00 UTC

[jira] [Updated] (GROOVY-6450) String.minus(String) and String.minus(Pattern) are inconsistent with List.minus(Collection).

     [ https://issues.apache.org/jira/browse/GROOVY-6450?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King updated GROOVY-6450:
------------------------------
    Fix Version/s:     (was: 3.x)
                   4.x

> String.minus(String) and String.minus(Pattern) are inconsistent with List.minus(Collection).
> --------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-6450
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6450
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-jdk
>    Affects Versions: 1.8.9, 2.0.8, 2.1.9, 2.2.0
>         Environment: Any
>            Reporter: James P. White
>            Priority: Major
>             Fix For: 4.x
>
>         Attachments: TestGROOVY_6450.groovy
>
>
> The String.minus operations only remove the first occurrence of the equal elements while List.minus removes all occurrences.  This is terribly inconsistent, as shown in these examples:
> {code}
> $ groovy -e "println ('abcabcabc' - 'b')"
> acabcabc
> $ groovy -e "println ((('abcabcabc' as List) - ('b' as List)).join())"
> acacac
> {code}
> Given my experience with trying work with multisets, I think I prefer the remove first/only one semantics.  Given String.minus' troubled history it is probably less disruptive to change it yet again.  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)