Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-1290

Provides a sensible default value for join()

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0-JSR-5
    • 1.0-JSR-6
    • groovy-jdk
    • None

    Description

      the GDK methode join() on arrays is defined as join(java.lang.String separator):
      assert ['a', 'b'].join('-') == 'a-b'

      If the separator is missing, groovy doesn't fail (good!), but it sets the separator to null.
      assert ['a', 'b'].join() == 'anullb'

      A sensible default should be provided, either an empty string (as in ruby), or a single blank, so that:
      assert ['a', 'b'].join() != 'anullb'
      assert ['a', 'b'].join() == 'ab' /* ruby-like */
      assert ['a', 'b'].join() == 'a b' /* own-convention */

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            galleon Ryan Harris
            d_n_a Denis N. Antonioli
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment