Skip to content

Commit 8ce6ca5

Browse files
committed
use String.contains() to improve the readability
1 parent 30aa4b6 commit 8ce6ca5

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

visualvm/libs.profiler/lib.profiler.charts/src/org/graalvm/visualvm/lib/charts/axis/TimeAxisUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ private static String createDateMonth(String dateYear) {
228228
}
229229

230230
private static boolean isPatternChar(String s) {
231-
return PATTERN_CHARS.indexOf(s) != -1;
231+
return PATTERN_CHARS.contains(s);
232232
}
233233

234234
}

visualvm/libs.profiler/lib.profiler.common/src/org/graalvm/visualvm/lib/common/integration/IntegrationUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public static boolean isFileModifiedForProfiler(File file) {
230230
return false;
231231
}
232232

233-
if (line.indexOf(MODIFIED_FOR_PROFILER_STRING) != -1) {
233+
if (line.contains(MODIFIED_FOR_PROFILER_STRING)) {
234234
br.close();
235235

236236
return true;
@@ -245,7 +245,7 @@ public static boolean isFileModifiedForProfiler(File file) {
245245
return false;
246246
}
247247

248-
if (line.indexOf(MODIFIED_FOR_PROFILER_STRING) != -1) {
248+
if (line.contains(MODIFIED_FOR_PROFILER_STRING)) {
249249
br.close();
250250

251251
return true;

visualvm/libs.profiler/lib.profiler.ui/src/org/graalvm/visualvm/lib/ui/components/JExtendedTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ public void keyPressed(KeyEvent e) {
403403
}
404404

405405
private boolean matchesFindCriterion(int row) {
406-
return getValueAt(row, userFindColumn).toString().toLowerCase().indexOf(internalFindString) != -1;
406+
return getValueAt(row, userFindColumn).toString().toLowerCase().contains(internalFindString);
407407
}
408408

409409
private boolean selectFoundNode(int row) {

visualvm/libs.profiler/lib.profiler.ui/src/org/graalvm/visualvm/lib/ui/components/JTreeTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ private boolean matchesFindCriterion(Object node) {
11181118
if (o == null) return false; // #207622, probably caused by updating the table while searching
11191119
String s = o.toString();
11201120
if (s == null) return false; // #207622, likely won't happen but just to be sure
1121-
return s.toLowerCase().indexOf(internalFindString) != -1;
1121+
return s.toLowerCase().contains(internalFindString);
11221122
}
11231123

11241124
private boolean selectFoundNode(CCTNode nodeToSelect, boolean requestFocus) {

0 commit comments

Comments
 (0)