Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.5, 1.5.1
-
Fix Version/s: 1.5.2
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Currently we have list*.method() that invokes the method on all items in the list.
It would be useful to also support list**.method() that invokes the method on all items in the list and recursively for any lists within the list.
def animalLists= [["ant", "mouse", "elephant"], ["deer", "monkey"]] assert animalLists.size() == 2 assert animalLists*.size() == [3, 2] assert animalLists**.size() == [[3, 5, 8], [4, 6]]
Interesting idea.
Do you think it should be a new notation, or in this case, wouldn't a method taking a closure be enough?
Say, something like collection.recurse { it.method() }