The other answers are correct for this specific example; however, in real cases, for instance when parsing a result using JsonSlurper or XmlSlurper and then replacing a character in it, the following Exception occurs:
groovy.lang.MissingMethodException: No signature of method: java.util.ArrayList.replaceAll() is applicable for argument types
Consider the following example,
def result = new JsonSlurper().parseText(totalAddress.toURL().text)
If one wants to replace a character such as '(' in result with a ' ' for example, the following returns the above Exception:
def subResult = result.replaceAll('\\(',' ')
This is due to the fact that the replaceAll method from Java works only for string types. For this to work, toString() should be added to the result of a variable defined using def:
def subResult = result.toString().replaceAll('\\[',' ')