groovy Its null-safe


Example

If there is a null object on the collection it not throws a NPE, it returns a null instead:

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

Using it directly in a null object it's also null-safe:

def nullCollection = null
assert nullCollection*.length() == null