What is the best way to remove null items from a list in Groovy?
ex: [null, 30, null]
[null, 30, null]
want to return: [30]
[30]
This can also be achieved by grep:
assert [null, 30, null].grep() == [30]
or
assert [null, 30, null].grep {it} == [30]
assert [null, 30, null].grep { it != null } == [30]