Use Collections.isEmpty() instead of .size() == 0
Ensure that Collections.isEmpty() is used to check if there are no elements in a collections. This is more explicit and can be faster than calling .size(). Closes gh-4783
This commit is contained in:
committed by
Phillip Webb
parent
6113643cbe
commit
786aacf2e9
@@ -39,7 +39,7 @@ public class HealthIndicatorAutoConfigurationProperties {
|
||||
}
|
||||
|
||||
public void setOrder(List<String> statusOrder) {
|
||||
if (statusOrder != null && statusOrder.size() > 0) {
|
||||
if (statusOrder != null && !statusOrder.isEmpty()) {
|
||||
this.order = statusOrder;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class OrderedHealthAggregator extends AbstractHealthAggregator {
|
||||
}
|
||||
}
|
||||
// If no status is given return UNKNOWN
|
||||
if (filteredCandidates.size() == 0) {
|
||||
if (filteredCandidates.isEmpty()) {
|
||||
return Status.UNKNOWN;
|
||||
}
|
||||
// Sort given Status instances by configured order
|
||||
|
||||
Reference in New Issue
Block a user