From 9de29ea3fcc63dc434d3337e56fb504e71262fb5 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 30 Dec 2021 20:34:10 +0000 Subject: [PATCH] use isEmpty() git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896541 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/poi/openxml4j/opc/ZipPackage.java | 4 ++-- .../org/apache/poi/xssf/eventusermodel/XSSFBReader.java | 2 +- .../java/org/apache/poi/xssf/eventusermodel/XSSFReader.java | 4 ++-- .../main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java | 4 ++-- .../main/java/org/apache/poi/xssf/usermodel/XSSFRow.java | 4 ++-- .../main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java | 2 +- .../java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java | 2 +- .../poi/xwpf/usermodel/XWPFAbstractFootnoteEndnote.java | 2 +- .../java/org/apache/poi/xwpf/usermodel/XWPFDocument.java | 2 +- .../org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java | 4 ++-- .../main/java/org/apache/poi/xwpf/usermodel/XWPFTable.java | 4 ++-- .../java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java | 2 +- .../java/org/apache/poi/xssf/TestXSSFXLookupFunction.java | 2 +- .../main/java/org/apache/poi/hwpf/model/CHPBinTable.java | 2 +- .../main/java/org/apache/poi/hwpf/model/PAPBinTable.java | 2 +- .../src/main/java/org/apache/poi/hwpf/usermodel/Range.java | 2 +- .../java/org/apache/poi/extractor/ExtractorFactory.java | 2 +- .../apache/poi/hssf/record/AbstractEscherHolderRecord.java | 2 +- .../java/org/apache/poi/hssf/record/DrawingGroupRecord.java | 5 ++--- .../org/apache/poi/hssf/record/common/UnicodeString.java | 2 +- .../main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java | 2 +- .../poi/poifs/eventfilesystem/POIFSReaderRegistry.java | 6 ++---- .../org/apache/poi/poifs/filesystem/POIFSFileSystem.java | 2 +- .../main/java/org/apache/poi/ss/format/CellFormatPart.java | 2 +- .../poi/ss/formula/EvaluationConditionalFormatRule.java | 2 +- .../org/apache/poi/ss/formula/atp/TextJoinFunction.java | 2 +- .../org/apache/poi/ss/formula/functions/LookupUtils.java | 2 -- 27 files changed, 34 insertions(+), 39 deletions(-) diff --git a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ZipPackage.java b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ZipPackage.java index af1a4c07b1..bf91ad17b0 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ZipPackage.java +++ b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ZipPackage.java @@ -537,8 +537,8 @@ public final class ZipPackage extends OPCPackage { try { // If the core properties part does not exist in the part list, // we save it as well - if (this.getPartsByRelationshipType(PackageRelationshipTypes.CORE_PROPERTIES).size() == 0 && - this.getPartsByRelationshipType(PackageRelationshipTypes.CORE_PROPERTIES_ECMA376).size() == 0 ) { + if (this.getPartsByRelationshipType(PackageRelationshipTypes.CORE_PROPERTIES).isEmpty() && + this.getPartsByRelationshipType(PackageRelationshipTypes.CORE_PROPERTIES_ECMA376).isEmpty()) { LOG.atDebug().log("Save core properties part"); // Ensure that core properties are added if missing diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java index d9a24bb855..9a02bcb4a0 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java @@ -108,7 +108,7 @@ public class XSSFBReader extends XSSFReader { public XSSFBStylesTable getXSSFBStylesTable() throws IOException { ArrayList parts = pkg.getPartsByContentType(XSSFBRelation.STYLES_BINARY.getContentType()); - if(parts.size() == 0) return null; + if(parts.isEmpty()) return null; // Create the Styles Table, and associate the Themes if present try (InputStream stream = parts.get(0).getInputStream()) { diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java index 220f5b89c4..64ed7297ee 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java @@ -144,7 +144,7 @@ public class XSSFReader { public SharedStrings getSharedStringsTable() throws IOException, InvalidFormatException { ArrayList parts = pkg.getPartsByContentType(XSSFRelation.SHARED_STRINGS.getContentType()); try { - return parts.size() == 0 ? null : + return parts.isEmpty() ? null : useReadOnlySharedStringsTable ? new ReadOnlySharedStringsTable(parts.get(0)) : new SharedStringsTable(parts.get(0)); } catch (SAXException se) { @@ -158,7 +158,7 @@ public class XSSFReader { */ public StylesTable getStylesTable() throws IOException, InvalidFormatException { ArrayList parts = pkg.getPartsByContentType(XSSFRelation.STYLES.getContentType()); - if (parts.size() == 0) return null; + if (parts.isEmpty()) return null; // Create the Styles Table, and associate the Themes if present StylesTable styles = new StylesTable(parts.get(0)); diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java index d4e22810b2..38ff3d3e09 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java @@ -198,7 +198,7 @@ public class SXSSFSheet implements Sheet, OoxmlSheetExtensions { if(_writer.getNumberOfFlushedRows() > 0) { return _writer.getLowestIndexOfFlushedRows(); } - return _rows.size() == 0 ? -1 : _rows.firstKey(); + return _rows.isEmpty() ? -1 : _rows.firstKey(); } /** @@ -208,7 +208,7 @@ public class SXSSFSheet implements Sheet, OoxmlSheetExtensions { */ @Override public int getLastRowNum() { - return _rows.size() == 0 ? -1 : _rows.lastKey(); + return _rows.isEmpty() ? -1 : _rows.lastKey(); } /** diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java index 85543d5ff0..15859f4fdb 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java @@ -304,7 +304,7 @@ public class XSSFRow implements Row, Comparable { */ @Override public short getFirstCellNum() { - return (short)(_cells.size() == 0 ? -1 : _cells.firstKey()); + return (short)(_cells.isEmpty() ? -1 : _cells.firstKey()); } /** @@ -328,7 +328,7 @@ public class XSSFRow implements Row, Comparable { */ @Override public short getLastCellNum() { - return (short)(_cells.size() == 0 ? -1 : (_cells.lastKey() + 1)); + return (short)(_cells.isEmpty() ? -1 : (_cells.lastKey() + 1)); } /** diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index 9f69900ec8..50ab442b15 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -2835,7 +2835,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx */ @Beta public void copyRows(List srcRows, int destStartRow, CellCopyPolicy policy) { - if (srcRows == null || srcRows.size() == 0) { + if (srcRows == null || srcRows.isEmpty()) { throw new IllegalArgumentException("No rows to copy"); } final Row srcStartRow = srcRows.get(0); diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java index ec17fa8809..0552d8182f 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java @@ -1383,7 +1383,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su sheets.remove(index); // only set new sheet if there are still some left - if(sheets.size() == 0) { + if(sheets.isEmpty()) { return; } diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFAbstractFootnoteEndnote.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFAbstractFootnoteEndnote.java index 7c97b908cd..0be1a2f74b 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFAbstractFootnoteEndnote.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFAbstractFootnoteEndnote.java @@ -503,7 +503,7 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable list) { // If there's nothing to find, skip it - if (list.size() == 0) { + if (list.isEmpty()) { return -1; } diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java index fea3e33b48..a839c587cf 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java @@ -603,7 +603,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo @Override protected void prepareForCommit() { // must contain at least an empty paragraph - if (bodyElements.size() == 0) { + if (bodyElements.isEmpty()) { createParagraph(); } @@ -611,7 +611,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo for (XWPFTable tbl : tables) { for (XWPFTableRow row : tbl.tableRows) { for (XWPFTableCell cell : row.getTableCells()) { - if (cell.getBodyElements().size() == 0) { + if (cell.getBodyElements().isEmpty()) { cell.addParagraph(); } } diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTable.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTable.java index 971ea0ffd5..00247afc92 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTable.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTable.java @@ -237,10 +237,10 @@ public class XWPFTable implements IBodyElement, ISDTContents { /** * Add a new cell at the end of each row in this table, creating a new column. * If rows have different numbers of columns, will still append a cell to each row. - * Currently does not match the width of existing columns. + * Currently, does not match the width of existing columns. */ public void addNewCol() { - if (tableRows.size() == 0) { + if (tableRows.isEmpty()) { createRow(); } for (XWPFTableRow tableRow : tableRows) { diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java index b81cde1eee..fe3140613a 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java @@ -441,7 +441,7 @@ public class XWPFTableCell implements IBody, ICell { } public void setText(String text) { - XWPFParagraph par = (paragraphs.size() == 0) ? addParagraph() : paragraphs.get(0); + XWPFParagraph par = paragraphs.isEmpty() ? addParagraph() : paragraphs.get(0); par.createRun().setText(text); } diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFXLookupFunction.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFXLookupFunction.java index dbe7c956fc..81fe37b623 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFXLookupFunction.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFXLookupFunction.java @@ -31,7 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** * Testcase for function XLOOKUP() */ -public class TestXSSFXLookupFunction { +class TestXSSFXLookupFunction { //https://support.microsoft.com/en-us/office/xlookup-function-b7fd680e-6d10-43e6-84f9-88eae8bf5929 diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/CHPBinTable.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/CHPBinTable.java index 1d0a570791..3f2bd01081 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/CHPBinTable.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/CHPBinTable.java @@ -242,7 +242,7 @@ public class CHPBinTable } } - if ( chpxs.size() == 0 ) + if ( chpxs.isEmpty() ) { LOG.atWarn().log("Text piece [{}; {}) has no CHPX. Creating new one.", box(startInclusive),box(boundary)); // create it manually diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/PAPBinTable.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/PAPBinTable.java index 675b62e8be..917c7d8958 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/PAPBinTable.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/PAPBinTable.java @@ -215,7 +215,7 @@ public class PAPBinTable lastPapxIndex = oldPapxSortedByEndPos.size() - 1; } - if ( papxs.size() == 0 ) + if ( papxs.isEmpty() ) { LOG.atWarn().log("Paragraph [{}; {}) has no PAPX. Creating new one.", box(startInclusive),box(endExclusive)); // create it manually diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/Range.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/Range.java index a3fd882d64..08d3840e56 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/Range.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/Range.java @@ -889,7 +889,7 @@ public class Range { private static int binarySearchStart( List> rpl, int start ) { - if ( rpl.size() == 0 ) + if ( rpl.isEmpty()) return -1; if ( rpl.get( 0 ).getStart() >= start ) return 0; 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 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, 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 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 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 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;