groovy Calling a method


Example

assert ['cat', 'dog', 'fish']*.length() == [3, 3, 4]

Note that when mixing types in the collection if the method not exists on some of the elements, a groovy.lang.MissingMethodException could be thrown:

['cat', 'dog', 'fish',3]*.length() 
// it throws groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.length()