Skip to content

Commit 9c577d5

Browse files
committed
use isEmpty() to improve the readability
1 parent f7d6ea5 commit 9c577d5

File tree

11 files changed

+13
-13
lines changed

11 files changed

+13
-13
lines changed

visualvm/core/src/org/graalvm/visualvm/core/explorer/ExplorerNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void addNodes(Set<ExplorerNode> newChildren) {
109109
break;
110110
case DataSourceDescriptor.EXPAND_ON_EACH_NEW_CHILD:
111111
case DataSourceDescriptor.EXPAND_ON_EACH_CHILD_CHANGE:
112-
if (newChildren.size() > 0) shouldExpand = true;
112+
if (!newChildren.isEmpty()) shouldExpand = true;
113113
break;
114114
}
115115
if (shouldExpand) ExplorerSupport.sharedInstance().expandNode(this);

visualvm/host/src/org/graalvm/visualvm/host/impl/Ping.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void add(Target t) {
137137
//
138138
void processPendingTargets() throws IOException {
139139
synchronized (pending) {
140-
while (pending.size() > 0) {
140+
while (!pending.isEmpty()) {
141141
Target t = pending.removeFirst();
142142
try {
143143

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ private boolean isOverCheckBox(int x, int y) {
391391
}
392392

393393
private void fireCheckTreeChanged(Collection changedNodes) {
394-
if (changedNodes.size() > 0) {
394+
if (!changedNodes.isEmpty()) {
395395
for (CheckTreeListener l : checkTreeListeners) {
396396
l.checkTreeChanged(changedNodes);
397397
}

visualvm/libs.profiler/lib.profiler.ui/src/org/graalvm/visualvm/lib/ui/cpu/StatisticsPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ private void updateSnippets() {
659659
container.add((JComponent) snippets.get(i), constraints);
660660
}
661661

662-
if (snippets.size() == 0) {
662+
if (snippets.isEmpty()) {
663663
constraints = new GridBagConstraints();
664664
constraints.gridx = 0;
665665
constraints.gridy = 2 + itemPresenters.size() + 1;

visualvm/libs.profiler/lib.profiler.ui/src/org/graalvm/visualvm/lib/ui/jdbc/TablesSelector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public void run() {
189189
}
190190

191191
private void updateSelectionButtons() {
192-
selectAll.setEnabled(selected.size() > 0);
192+
selectAll.setEnabled(!selected.isEmpty());
193193
unselectAll.setEnabled(selected.size() < tables.length);
194194
}
195195

visualvm/libs.profiler/lib.profiler/src/org/graalvm/visualvm/lib/jfluid/utils/MiscUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ public static String getLiveClassPathSubset(String path, String workingDir) {
290290
List liveComponents = getPathComponents(path, true, workingDir);
291291
StringBuilder buf = new StringBuilder(liveComponents.size() * 10);
292292

293-
if (liveComponents.size() > 0) {
293+
if (!liveComponents.isEmpty()) {
294294
buf.append((String) liveComponents.get(0));
295295

296296
for (int i = 1; i < liveComponents.size(); i++) {

visualvm/libs.profiler/lib.profiler/test/qa-functional/src/org/graalvm/visualvm/lib/jfluid/tests/jfluid/cpu/CPUTestCase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ protected void startCPUTest(ProfilerEngineSettings settings, String[] measuredMe
367367

368368
setStatus(STATUS_MEASURED);
369369

370-
if (methods.size() > 0) {
370+
if (!methods.isEmpty()) {
371371
Collections.sort(methods);
372372

373373
for (int mets = 0; mets < methods.size(); mets++) {
@@ -475,7 +475,7 @@ protected void startCPUTest(ProfilerEngineSettings settings, String[] measuredMe
475475
time = System.currentTimeMillis();
476476
}
477477

478-
if (methods.size() == 0) {
478+
if (methods.isEmpty()) {
479479
assertTrue("Results were not on the server - issue 65185", false);
480480
}
481481
} catch (Exception ex) {

visualvm/libs.profiler/lib.profiler/test/unit/src/org/graalvm/visualvm/lib/jfluid/results/cpu/StackTraceSnapshotBuilderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,8 @@ public void testReset() {
743743

744744
instance.reset();
745745
assertTrue(instance.methodInfos.size()-1 == 0);
746-
assertTrue(instance.threadIds.size() == 0);
747-
assertTrue(instance.threadNames.size() == 0);
746+
assertTrue(instance.threadIds.isEmpty());
747+
assertTrue(instance.threadNames.isEmpty());
748748
assertEquals(-1L, instance.currentDumpTimeStamp);
749749
//assertEquals(-1L, instance.firstDumpTimeStamp);
750750
assertEquals(0, instance.stackTraceCount);

visualvm/libs.profiler/profiler.oql/test/unit/src/org/graalvm/visualvm/lib/profiler/oql/repository/api/OQLQueryRepositoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void testListAllCategories() {
7070
System.out.println("listAllCategories");
7171

7272
List result = instance.listCategories();
73-
assertTrue(result.size() > 0);
73+
assertTrue(!result.isEmpty());
7474
}
7575

7676
/**

visualvm/libs.profiler/profiler.snaptracer/src/org/graalvm/visualvm/lib/profiler/snaptracer/impl/timeline/TimelineChart.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ protected void computeDataBounds() {
395395
}
396396

397397
dataBounds.y = 0;
398-
Row lastRow = rows.size() > 0 ? rows.get(rows.size() - 1) : null;
398+
Row lastRow = rows.isEmpty() ? null : rows.get(rows.size() - 1);
399399
dataBounds.height = lastRow != null ? lastRow.getOffset() + lastRow.getHeight() : 0;
400400
}
401401

0 commit comments

Comments
 (0)