Returns an Optional containing the first element that matches the given predicate. Returns an empty Optional if no element matches.
Example:
var list = new ArrayList<string> (GLib.str_equal);
list.add ("apple");
list.add ("banana");
var found = list.find ((s) => { return s == "banana"; });
assert (found.isPresent ());
assert (found.get () == "banana");
| func |
the predicate to test each element. |
|
an Optional containing the first matching element. |