它是無效的
如果集合上有 null 物件,則不會丟擲 NPE,而是返回 null:
assert ['cat', 'dog', 'fish', null]*.length() == [3, 3, 4, null]
直接在 null 物件中使用它也是 null 安全的:
def nullCollection = null
assert nullCollection*.length() == null
如果集合上有 null 物件,則不會丟擲 NPE,而是返回 null:
assert ['cat', 'dog', 'fish', null]*.length() == [3, 3, 4, null]
直接在 null 物件中使用它也是 null 安全的:
def nullCollection = null
assert nullCollection*.length() == null