src/main/java: minor refactor

Use isEmpty() instead of checking size.
This commit is contained in:
Alan Orth 2023-12-28 10:26:11 +03:00
parent 9e965afdb7
commit f9d7e5f6a2
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -91,7 +91,7 @@ public class CountryCodeTagger extends AbstractCurationTask {
itemService.getMetadataByMetadataString(item, config.iso3166Field); itemService.getMetadataByMetadataString(item, config.iso3166Field);
// skip items that don't have country metadata // skip items that don't have country metadata
if (itemCountries.size() == 0) { if (itemCountries.isEmpty()) {
alpha2Result.setResult(itemHandle + ": no countries, skipping."); alpha2Result.setResult(itemHandle + ": no countries, skipping.");
alpha2Result.setStatus(Curator.CURATE_SKIP); alpha2Result.setStatus(Curator.CURATE_SKIP);
} else { } else {
@ -134,7 +134,7 @@ public class CountryCodeTagger extends AbstractCurationTask {
List<MetadataValue> itemAlpha2CountryCodes = List<MetadataValue> itemAlpha2CountryCodes =
itemService.getMetadataByMetadataString(item, config.iso3166Alpha2Field); itemService.getMetadataByMetadataString(item, config.iso3166Alpha2Field);
if (itemAlpha2CountryCodes.size() == 0) { if (itemAlpha2CountryCodes.isEmpty()) {
List<String> newAlpha2Codes = new ArrayList<String>(); List<String> newAlpha2Codes = new ArrayList<String>();
for (MetadataValue itemCountry : itemCountries) { for (MetadataValue itemCountry : itemCountries) {
// check ISO 3166-1 countries // check ISO 3166-1 countries
@ -158,7 +158,7 @@ public class CountryCodeTagger extends AbstractCurationTask {
} }
} }
if (newAlpha2Codes.size() > 0) { if (!newAlpha2Codes.isEmpty()) {
try { try {
itemService.addMetadata( itemService.addMetadata(
Curator.curationContext(), Curator.curationContext(),