RFR: 8287497: Use String.contains() instead of String.indexOf() in java.naming

Raffaello Giulietti duke at openjdk.java.net
Mon May 30 08:59:41 UTC 2022


On Sun, 29 May 2022 14:00:20 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

> `String.contains` was introduced in Java 5.
> Some code in java.naming still uses old approach with `String.indexOf` to check if String contains specified substring.
> I propose to migrate such usages. Makes code shorter and easier to read.

_(not a reviewer)_
Provided `indexOf() != -1` and `indexOf() >= 0` are equivalent (which should indeed be the case, according to the Javadoc), the changes look good

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

PR: https://git.openjdk.java.net/jdk/pull/8938


More information about the core-libs-dev mailing list