On Tue, 29 Aug 2023 02:58:11 GMT, Quan Anh Mai <qa...@openjdk.org> wrote:

> This is similar to `std::find_if` and should be just:
> 
> ```
>   template<class UnaryPredicate>
>   int find_if(UnaryPredicate p) const {
>     for (int i = 0; i < _len; i++) {
>       if (p(_data[i])) {
>         return i;
>       }
>     }
>     return -1;
>   }
> ```
> 
> Regarding the current approach, the comparator should take a `const E&` 
> instead of an `E`, and the token passed in should be `const` also.

Thank you  @merykitty for this comment. 
It is fixed now.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15418#issuecomment-1709587729

Reply via email to