Simplify a null check in the private replaceEach() method. (#514)

This commit is contained in:
Isira Seneviratne 2020-04-20 20:54:33 +00:00 committed by GitHub
parent 96caf42b31
commit 0b899ee40b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -6717,8 +6717,7 @@ public class StringUtils {
// index of replace array that will replace the search string found // index of replace array that will replace the search string found
// NOTE: logic duplicated below START // NOTE: logic duplicated below START
for (int i = 0; i < searchLength; i++) { for (int i = 0; i < searchLength; i++) {
if (noMoreMatchesForReplIndex[i] || searchList[i] == null || if (noMoreMatchesForReplIndex[i] || isEmpty(searchList[i]) || replacementList[i] == null) {
searchList[i].isEmpty() || replacementList[i] == null) {
continue; continue;
} }
tempIndex = text.indexOf(searchList[i]); tempIndex = text.indexOf(searchList[i]);