Use String indexOf(char) and lastIndexOf(char) where possible

Closes gh-11416
This commit is contained in:
Andy Wilkinson
2019-07-04 17:44:40 +01:00
parent 6a777a7f9b
commit 4b2a116fa7
7 changed files with 11 additions and 11 deletions

View File

@@ -108,7 +108,7 @@ class BindFailureAnalyzerTests {
MutablePropertySources sources = context.getEnvironment().getPropertySources();
Map<String, Object> map = new HashMap<>();
for (String pair : environment) {
int index = pair.indexOf("=");
int index = pair.indexOf('=');
String key = (index > 0) ? pair.substring(0, index) : pair;
String value = (index > 0) ? pair.substring(index + 1) : "";
map.put(key.trim(), value.trim());

View File

@@ -119,7 +119,7 @@ class BindValidationFailureAnalyzerTests {
MutablePropertySources sources = context.getEnvironment().getPropertySources();
Map<String, Object> map = new HashMap<>();
for (String pair : environment) {
int index = pair.indexOf("=");
int index = pair.indexOf('=');
String key = (index > 0) ? pair.substring(0, index) : pair;
String value = (index > 0) ? pair.substring(index + 1) : "";
map.put(key.trim(), value.trim());

View File

@@ -91,7 +91,7 @@ class UnboundConfigurationPropertyFailureAnalyzerTests {
MutablePropertySources sources = context.getEnvironment().getPropertySources();
Map<String, Object> map = new HashMap<>();
for (String pair : environment) {
int index = pair.indexOf("=");
int index = pair.indexOf('=');
String key = (index > 0) ? pair.substring(0, index) : pair;
String value = (index > 0) ? pair.substring(index + 1) : "";
map.put(key.trim(), value.trim());