golo-lang/golo-lang — pull request #81 by danielpetisme (2013-09-26 13:40:13+00:00)
Title: Add a "find" method to Collections SA

Find returns the first element of the collection which matches the predicate or null
module test
```
function main = |args| {
let myList = list[1,2,3,4,5]
require(myList: find(|it| -> (it % 2) is 0) is 2, "Should returns the first even number")
require(myList: find(|it| -> it oftype java.lang.String.class) is null, "Should retuns null, there is no String in the list")

let myMap = map[[1, "a"],[2,"b"], [3,"c"], [4,"d"]]
require(myMap: find(|k, v| -> (k % 2) is 0): getValue() is "b", "Should returns the first even number with value b")
require(myMap: find(|k, v| -> k oftype java.lang.String.class) is null, "Should retuns null, the keys are integers not Strings")
}
```

Works with: lists, sets, maps & tuples