If the given array contains an element matching the given predicate, returns its value, otherwise adds the result of calling the given factory function to the end, and returns that.
If the given array contains an element matching the given predicate, returns its value, otherwise adds the result of calling the given factory function to the end, and returns that.