If the given array contains an element matching the given predicate, returns its value,
otherwise adds the given default value to the end, and returns that.
For your convenience the given value is also passed to the predicate as a second parameter,
so you can easily compare the two if needed.
If the given array contains an element matching the given predicate, returns its value, otherwise adds the given default value to the end, and returns that. For your convenience the given value is also passed to the predicate as a second parameter, so you can easily compare the two if needed.