find


Description:

public Optional<T> find (owned PredicateFunc<T> func)

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");

Parameters:

func

the predicate to test each element.

Returns:

an Optional containing the first matching element.