Fixing squid:S1155 - Collection.isEmpty() should be used to test for emptiness

This commit is contained in:
Artyom Melnikov committed 2016-06-22 13:43:15 +03:00
1 parent a64a020e36
commit 0a3b819991
66 files changed
+92 -92

No files matched your search

@@ -522,7 +522,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
List<SpiExpression> exprList = whereExpressions.internalList();
if (exprList.size() > 1) {
return null;
} else if (exprList.size() == 0) {
} else if (exprList.isEmpty()) {
return namedBind;
} else {
if (namedBind != null) {
@@ -1151,7 +1151,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
@Override
public DefaultOrmQuery<T> order(String orderByClause) {
if (orderByClause == null || orderByClause.trim().length() == 0) {
if (orderByClause == null || orderByClause.trim().isEmpty()) {
this.orderBy = null;
} else {
this.orderBy = new OrderBy<T>(this, orderByClause);
@@ -198,7 +198,7 @@ public class OrmQueryDetail implements Serializable {
}
}
if (matchingPaths.size() == 0) {
if (matchingPaths.isEmpty()) {
return null;
}
@@ -134,7 +134,7 @@ public class OrmQueryDetailParser {
}
}
String whereClause = sb.toString().trim();
if (whereClause.length() > 0) {
if (!whereClause.isEmpty()) {
rawWhereClause = whereClause;
}
@@ -236,7 +236,7 @@ public class OrmQueryProperties implements Serializable {
@SuppressWarnings("unchecked")
public void configureBeanQuery(SpiQuery<?> query) {
if (trimmedProperties != null && trimmedProperties.length() > 0) {
if (trimmedProperties != null && !trimmedProperties.isEmpty()) {
query.select(trimmedProperties);
}
@@ -122,7 +122,7 @@ public class OrmQueryPropertiesParser {
String temp;
for (int i = 0; i < res.length; i++) {
temp = res[i].trim();
if (temp.length() > 0) {
if (!temp.isEmpty()) {
if (count > 0) {
sb.append(",");
}