Apply the transformation to non-collection entries, delving into nested collections too and preserving the whole structure.
def lst = ['foo', 'bar', ['inner_foo', 'inner_bar']]
lst.collectNested { it.toUpperCase() } // [FOO, BAR, [INNER_FOO, INNER_BAR]]