Stephen King's non-fiction Books:
<g:grep in="${books}" filter="NonFictionBooks.class">
<p>Title: ${it.title}</p>
</g:grep>
<g:grep in="${books.title}" filter="~/.*Groovy.*/">
<p>Title: ${it}</p>
</g:grep>
1. grep
1.1. Purpose
Uses the Groovy JDK grep
method to iterate over each element of the specified object that match the
specified "filter" attribute. The filter can be different instances such as classes, regex patterns etc.
1.2. Examples
1.3. Description
Attributes
-
in
- The object to iterative over -
filter
- The filter instance such as a class, regular expression or anything that implementsisCase