Collection.isEmpty() should be used to test for emptiness
Closes gh-1670
This commit is contained in:
committed by
Stephane Nicoll
parent
7da40abba5
commit
e381514b07
@@ -40,7 +40,7 @@ class DatabasePopulatorConfigUtils {
|
||||
|
||||
public static void setDatabasePopulator(Element element, BeanDefinitionBuilder builder) {
|
||||
List<Element> scripts = DomUtils.getChildElementsByTagName(element, "script");
|
||||
if (scripts.size() > 0) {
|
||||
if (!scripts.isEmpty()) {
|
||||
builder.addPropertyValue("databasePopulator", createDatabasePopulator(element, scripts, "INIT"));
|
||||
builder.addPropertyValue("databaseCleaner", createDatabasePopulator(element, scripts, "DESTROY"));
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ public class CallMetaDataContext {
|
||||
if (this.outParameterNames.size() > 1) {
|
||||
logger.warn("Accessing single output value when procedure has more than one output parameter");
|
||||
}
|
||||
return (this.outParameterNames.size() > 0 ? this.outParameterNames.get(0) : null);
|
||||
return (!this.outParameterNames.isEmpty() ? this.outParameterNames.get(0) : null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ public class CallMetaDataContext {
|
||||
SqlParameter param;
|
||||
if (meta.getParameterType() == DatabaseMetaData.procedureColumnReturn) {
|
||||
param = declaredParams.get(getFunctionReturnName());
|
||||
if (param == null && getOutParameterNames().size() > 0) {
|
||||
if (param == null && !getOutParameterNames().isEmpty()) {
|
||||
param = declaredParams.get(getOutParameterNames().get(0).toLowerCase());
|
||||
}
|
||||
if (param == null) {
|
||||
|
||||
@@ -184,7 +184,7 @@ public class TableMetaDataContext {
|
||||
if (generatedKeyNames.length > 0) {
|
||||
this.generatedKeyColumnsUsed = true;
|
||||
}
|
||||
if (declaredColumns.size() > 0) {
|
||||
if (!declaredColumns.isEmpty()) {
|
||||
return new ArrayList<>(declaredColumns);
|
||||
}
|
||||
Set<String> keys = new LinkedHashSet<>(generatedKeyNames.length);
|
||||
|
||||
@@ -61,7 +61,7 @@ public class GeneratedKeyHolder implements KeyHolder {
|
||||
@Override
|
||||
@Nullable
|
||||
public Number getKey() throws InvalidDataAccessApiUsageException, DataRetrievalFailureException {
|
||||
if (this.keyList.size() == 0) {
|
||||
if (this.keyList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (this.keyList.size() > 1 || this.keyList.get(0).size() > 1) {
|
||||
@@ -89,7 +89,7 @@ public class GeneratedKeyHolder implements KeyHolder {
|
||||
@Override
|
||||
@Nullable
|
||||
public Map<String, Object> getKeys() throws InvalidDataAccessApiUsageException {
|
||||
if (this.keyList.size() == 0) {
|
||||
if (this.keyList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (this.keyList.size() > 1)
|
||||
|
||||
Reference in New Issue
Block a user