diff options
author | PJ Fanning <fanningpj@apache.org> | 2021-12-30 20:34:10 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2021-12-30 20:34:10 +0000 |
commit | 9de29ea3fcc63dc434d3337e56fb504e71262fb5 (patch) | |
tree | 3a218cb5c23df283c566362ac6c194cd8c06fcb1 /poi | |
parent | 15b1c51f3397950fb35a4419924c71cedee6c068 (diff) | |
download | poi-9de29ea3fcc63dc434d3337e56fb504e71262fb5.tar.gz poi-9de29ea3fcc63dc434d3337e56fb504e71262fb5.zip |
use isEmpty()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896541 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
11 files changed, 12 insertions, 17 deletions
diff --git a/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java b/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java index 03a8278077..759e75e068 100644 --- a/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java +++ b/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java @@ -347,7 +347,7 @@ public final class ExtractorFactory { } // Create the extractors - if(dirs.size() == 0 && nonPOIFS.size() == 0){ + if(dirs.isEmpty() && nonPOIFS.isEmpty()){ return new POITextExtractor[0]; } diff --git a/poi/src/main/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java b/poi/src/main/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java index 5d022a2605..0f1377aa03 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java @@ -117,7 +117,7 @@ public abstract class AbstractEscherHolderRecord extends Record { @Override public int getRecordSize() { byte[] rawData = getRawData(); - if (escherRecords.size() == 0 && rawData != null) { + if (escherRecords.isEmpty() && rawData != null) { // XXX: It should be possible to derive this without concatenating the array, too. return rawData.length; } diff --git a/poi/src/main/java/org/apache/poi/hssf/record/DrawingGroupRecord.java b/poi/src/main/java/org/apache/poi/hssf/record/DrawingGroupRecord.java index 91d805a381..ee301fce45 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/DrawingGroupRecord.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/DrawingGroupRecord.java @@ -82,7 +82,7 @@ public final class DrawingGroupRecord extends AbstractEscherHolderRecord { public int serialize(int offset, byte[] data) { byte[] rawData = getRawData(); - if (getEscherRecords().size() == 0 && rawData != null) + if (getEscherRecords().isEmpty() && rawData != null) { return writeData( offset, data, rawData ); } @@ -117,8 +117,7 @@ public final class DrawingGroupRecord extends AbstractEscherHolderRecord { private int getRawDataSize() { List<EscherRecord> escherRecords = getEscherRecords(); byte[] rawData = getRawData(); - if (escherRecords.size() == 0 && rawData != null) - { + if (escherRecords.isEmpty() && rawData != null) { return rawData.length; } int size = 0; diff --git a/poi/src/main/java/org/apache/poi/hssf/record/common/UnicodeString.java b/poi/src/main/java/org/apache/poi/hssf/record/common/UnicodeString.java index 37fd7e0ec5..9769f3cb1f 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/common/UnicodeString.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/common/UnicodeString.java @@ -337,7 +337,7 @@ public class UnicodeString implements Comparable<UnicodeString>, Duplicatable, G public void removeFormatRun(FormatRun r) { field_4_format_runs.remove(r); - if (field_4_format_runs.size() == 0) { + if (field_4_format_runs.isEmpty()) { field_4_format_runs = null; field_2_optionflags = richText.clearByte(field_2_optionflags); } diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java index f77cc16205..0bc614264e 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -316,7 +316,7 @@ public final class HSSFSheet implements Sheet { _sheet.removeRow(hrow.getRowRecord()); // if there are no more rows, then reset first/last - if(_rows.size() == 0) { + if(_rows.isEmpty()) { _firstrow = -1; _lastrow = -1; } diff --git a/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java b/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java index 2091eec512..3b2af081be 100644 --- a/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java +++ b/poi/src/main/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java @@ -150,13 +150,11 @@ class POIFSReaderRegistry } private void dropDocument(final POIFSReaderListener listener, - final DocumentDescriptor descriptor) - { + final DocumentDescriptor descriptor) { Set<POIFSReaderListener> listeners = chosenDocumentDescriptors.get(descriptor); listeners.remove(listener); - if (listeners.size() == 0) - { + if (listeners.isEmpty()) { chosenDocumentDescriptors.remove(descriptor); } } diff --git a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java index eba62568b9..6194efab28 100644 --- a/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java +++ b/poi/src/main/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java @@ -583,7 +583,7 @@ public class POIFSFileSystem extends BlockStore offset++; // Chain it - if (_xbat_blocks.size() == 0) { + if (_xbat_blocks.isEmpty()) { _header.setXBATStart(offset); } else { _xbat_blocks.get(_xbat_blocks.size() - 1).setValueAt( diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java b/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java index c350f5f363..9ecc5ce53d 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java @@ -48,7 +48,7 @@ import static org.apache.poi.ss.format.CellFormatter.quote; */ @SuppressWarnings("RegExpRepeatedSpace") public class CellFormatPart { - private static final Logger LOG = LogManager.getLogger(CellFormat.class.getName()); + private static final Logger LOG = LogManager.getLogger(CellFormatPart.class); static final Map<String, Color> NAMED_COLORS; diff --git a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java index b1c3504f2b..b3fb95f593 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java @@ -598,7 +598,7 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon } final Set<ValueAndFormat> avgSet = new LinkedHashSet<>(1); - avgSet.add(new ValueAndFormat(allValues.size() == 0 ? 0 : total / allValues.size(), null, decimalTextFormat)); + avgSet.add(new ValueAndFormat(allValues.isEmpty() ? 0 : total / allValues.size(), null, decimalTextFormat)); final double stdDev = allValues.size() <= 1 ? 0 : ((NumberEval) AggregateFunction.STDEV.evaluate(pop, 0, 0)).getNumberValue(); avgSet.add(new ValueAndFormat(stdDev, null, decimalTextFormat)); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/atp/TextJoinFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/atp/TextJoinFunction.java index 14a17854f3..52fcb05cc0 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/atp/TextJoinFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/atp/TextJoinFunction.java @@ -93,7 +93,7 @@ final class TextJoinFunction implements FreeRefFunction { } // Join the list of values with the specified delimiter and return - if (delimiterArgs.size() == 0) { + if (delimiterArgs.isEmpty()) { return new StringEval(String.join("", textValues)); } else if (delimiterArgs.size() == 1) { String delimiter = laxValueToString(delimiterArgs.get(0)); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java index 648250beca..c76bfc0f4e 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java @@ -22,8 +22,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.NoSuchElementException; -import java.util.Spliterator; -import java.util.Spliterators; import java.util.regex.Matcher; import java.util.regex.Pattern; |