Groovy Functional Programming - Filtering with findAll
In my previous post, I wrote about map transformation. Similarly, another common operation is filtering values from a collection that satisfy a condition. We refer to the condition as a predicate.
Consider the following list of numbers.
def numbers = [1, 2, 3, 4, 5, 6, 7]
Let's write