Skip to content

Instantly share code, notes, and snippets.

@azenla
Created July 31, 2013 17:19
Show Gist options
  • Save azenla/6124080 to your computer and use it in GitHub Desktop.
Save azenla/6124080 to your computer and use it in GitHub Desktop.
:) Turns an ArrayList into a string, even though its not needed since Groovy has .join(' ')
ArrayList.metaClass.asString = { ->
def builder = new StringBuilder()
delegate.eachWithIndex { object, index -> builder.append(object) ; if (!(index==delegate.size() - 1)) builder.append(' ')}
return builder.toString()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment