groovy

Provides a sensible default value for join()

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.0-JSR-5
  • Fix Version/s: 1.0-JSR-6
  • Component/s: groovy-jdk
  • Labels:
    None
  • Number of attachments :
    0

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 */

Activity

Hide
Guillaume ALLEON added a comment -

"" as been set as the default value. CVS updated

Show
Guillaume ALLEON added a comment - "" as been set as the default value. CVS updated

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: