On Mon, 27 Feb 2023 12:25:54 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> 
wrote:

>> Consistency with the indexOf/lastIndexOf methods is good, it makes it look 
>> like the method has been there since JDK 1.0. At the same time, it could 
>> mean that bugs go undetected, e.g. it would be easy to assume the range is 
>> fromIndex + length or to specify the parameters in the wrong order. I don't 
>> know if you explored other options but if the new method had a new name then 
>> maybe you have the option to throw for out of range index values.
>
> @AlanBateman I can propose variants of forward-searching 
> _some-prefix_`IndexOf()` which are consistent with `substring()` in their 
> handling of the indices, but I'd then rather prefer to file another JBS issue 
> and prepare another PR.
> 
> The proposed 3 parameters variant of `indexOf()` _is_ the real "primitive" of 
> the family. The other ones are mere shortcuts.

Parking this PR while exploration is done into other options is okay.

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

PR: https://git.openjdk.org/jdk/pull/12600

Reply via email to