Adds various function extensions to java.util.List implementations.
| Property Summary | |
|---|---|
int
|
length
|
| Function Summary | |
|---|---|
void
|
each(Function func)
|
Object
|
find(Function func)
|
java.util.List
|
findAll(Function func)
|
void each(Function func)
Iterates through the collection and for each element, calls the passed function with the element as the parameter.
list.each(function(item) { print(item) })
Object find(Function func)
Finds the first item selected by the passed function. The function will receive the item and should return true or false for the result.
item = list.find(function(item) { return item.matches(/foo[0-9]/) })
java.util.List findAll(Function func)
Finds all items selected by the passed function. The function will receive the item and should return true or false for the result. A list of all matches will be returned.
matches = list.findAll(function(item) { return item.matches(/foo[0-9]/) })