From 7e380e5d982c073ad7157c9ee95abb0c0118d12b Mon Sep 17 00:00:00 2001 From: reudismam Date: Fri, 2 Feb 2018 12:28:25 -0300 Subject: [PATCH] Use isEmpty method. --- .../net/sourceforge/pmd/lang/dfa/pathfinder/CurrentPath.java | 2 +- .../java/net/sourceforge/pmd/lang/metrics/MetricOptions.java | 2 +- .../errorprone/AvoidBranchingStatementAsLastInLoopRule.java | 4 ++-- .../net/sourceforge/pmd/lang/java/xpath/MetricFunction.java | 2 +- .../pmd/util/fxdesigner/MainDesignerController.java | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/pathfinder/CurrentPath.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/pathfinder/CurrentPath.java index e23e3c2082..86827e2ff0 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/pathfinder/CurrentPath.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/pathfinder/CurrentPath.java @@ -68,7 +68,7 @@ public class CurrentPath implements Iterable { } public boolean isEndNode() { - return this.getLast().getChildren().size() == 0; + return this.getLast().getChildren().isEmpty(); // return inode instanceof StartOrEndDataFlowNode; } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/metrics/MetricOptions.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/metrics/MetricOptions.java index 536a7db023..033fb2c361 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/metrics/MetricOptions.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/metrics/MetricOptions.java @@ -158,7 +158,7 @@ public class MetricOptions { MetricOptions build() { - if (opts.size() == 0) { + if (opts.isEmpty()) { return emptyOptions(); } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/AvoidBranchingStatementAsLastInLoopRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/AvoidBranchingStatementAsLastInLoopRule.java index cf0f5b99a6..4a897421bc 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/AvoidBranchingStatementAsLastInLoopRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/AvoidBranchingStatementAsLastInLoopRule.java @@ -118,7 +118,7 @@ public class AvoidBranchingStatementAsLastInLoopRule extends AbstractJavaRule { public boolean checksNothing() { - return getProperty(CHECK_BREAK_LOOP_TYPES).size() == 0 && getProperty(CHECK_CONTINUE_LOOP_TYPES).size() == 0 - && getProperty(CHECK_RETURN_LOOP_TYPES).size() == 0; + return getProperty(CHECK_BREAK_LOOP_TYPES).isEmpty() && getProperty(CHECK_CONTINUE_LOOP_TYPES).isEmpty() + && getProperty(CHECK_RETURN_LOOP_TYPES).isEmpty(); } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/xpath/MetricFunction.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/xpath/MetricFunction.java index d53d88bb87..bf3cccd07b 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/xpath/MetricFunction.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/xpath/MetricFunction.java @@ -37,7 +37,7 @@ public class MetricFunction implements Function { String metricKeyName = null; - if (args.size() == 0) { + if (args.isEmpty()) { throw new IllegalArgumentException(badMetricKeyArgMessage()); } diff --git a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/MainDesignerController.java b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/MainDesignerController.java index fd2f8bafa8..c56d49b13d 100644 --- a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/MainDesignerController.java +++ b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/MainDesignerController.java @@ -304,7 +304,7 @@ public class MainDesignerController implements Initializable, SettingsOwner { private void onFileMenuShowing() { - openRecentMenu.setDisable(recentFiles.size() == 0); + openRecentMenu.setDisable(recentFiles.isEmpty()); }