You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/08/02 16:20:00 UTC

[jira] [Comment Edited] (GROOVY-11145) add a join() method for Iterable/List

    [ https://issues.apache.org/jira/browse/GROOVY-11145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17750393#comment-17750393 ] 

Eric Milles edited comment on GROOVY-11145 at 8/2/23 4:19 PM:
--------------------------------------------------------------

If you checked for {{null}} as the separator, could you assume "empty"?

Update: in fact that's what it does:
{code:java}
    public static String join(Iterator<?> self, String separator) {
        if (separator == null) separator = "";
{code}


was (Author: emilles):
If you checked for {{null}} as the separator, could you assume "empty"?

> add a join() method for Iterable/List
> -------------------------------------
>
>                 Key: GROOVY-11145
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11145
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 2.5.12, 3.0.9, 4.0.13
>            Reporter: Jochen Theodorou
>            Priority: Minor
>
> {code:Java}
>   @groovy.transform.CompileStatic
>   def m() {
>     ["a", "b"].join()
>   }
>   assert m() == "ab"
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)