Learning Groovy by Adam L. Davis

Learning Groovy by Adam L. Davis

Author:Adam L. Davis
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


Figure 9-2. Filter (findAll): Gives you a sub-set of elements (what returns true from some predicate function)

Figure 9-3. Reduce (inject): Performs a reduction (returning one result, such as a sum) on the elements

Figure 9-4. Limit ([0..n-1]): Gives you only the first N elements

Figure 9-5. Concat (+): Combines two different collections of elements

class Person { String name; int age }

def persons = [new Person(name:'Bob',age:20),

new Person(name:'Tom',age:15)]

1 def names = persons.collect { person -> person.name }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.