Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
e.g. along these lines
http://www.rubycentral.com/ref/ref_m_enumerable.html#grep
In groovy we could do
[1, 2, 3, 4, 5, 6, 7].grep(2..4)
-> [2, 3, 4]
or
["ab", "ac", "bc"].grep(~"a")
-> ["ab", "ac"]
or
[1.1, 2, 3.4, 5.6, 7].grep(Integer)
-> [2, 7]
At the implementation we can find the items in the collection which return true for the 'isCase' method (used in switch statements)