mirror of
https://github.com/apache/poi.git
synced 2025-02-06 10:08:17 +00:00
use zero size arg to toArray(), use Collection.addAll() (#63805, second patch)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1869919 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
10e0e3d108
commit
4f8879f8ef
@ -76,9 +76,9 @@ public class BarChartDemo {
|
||||
listSpeakers.add(Double.valueOf(vals[1]));
|
||||
listLanguages.add(vals[2]);
|
||||
}
|
||||
String[] categories = listLanguages.toArray(new String[listLanguages.size()]);
|
||||
Double[] values1 = listCountries.toArray(new Double[listCountries.size()]);
|
||||
Double[] values2 = listSpeakers.toArray(new Double[listSpeakers.size()]);
|
||||
String[] categories = listLanguages.toArray(new String[0]);
|
||||
Double[] values1 = listCountries.toArray(new Double[0]);
|
||||
Double[] values2 = listSpeakers.toArray(new Double[0]);
|
||||
|
||||
try (XMLSlideShow pptx = new XMLSlideShow(argIS)) {
|
||||
XSLFSlide slide = pptx.getSlides().get(0);
|
||||
|
@ -79,9 +79,9 @@ public class ChartFromScratch {
|
||||
listLanguages.add(vals[2]);
|
||||
}
|
||||
|
||||
String[] categories = listLanguages.toArray(new String[listLanguages.size()]);
|
||||
Double[] values1 = listCountries.toArray(new Double[listCountries.size()]);
|
||||
Double[] values2 = listSpeakers.toArray(new Double[listSpeakers.size()]);
|
||||
String[] categories = listLanguages.toArray(new String[0]);
|
||||
Double[] values1 = listCountries.toArray(new Double[0]);
|
||||
Double[] values2 = listSpeakers.toArray(new Double[0]);
|
||||
|
||||
try {
|
||||
|
||||
|
@ -89,8 +89,8 @@ public class PieChartDemo {
|
||||
listCategories.add(vals[0]);
|
||||
listValues.add(Double.valueOf(vals[1]));
|
||||
}
|
||||
String[] categories = listCategories.toArray(new String[listCategories.size()]);
|
||||
Double[] values = listValues.toArray(new Double[listValues.size()]);
|
||||
String[] categories = listCategories.toArray(new String[0]);
|
||||
Double[] values = listValues.toArray(new Double[0]);
|
||||
|
||||
final int numOfPoints = categories.length;
|
||||
final String categoryDataRange = chart.formatRange(new CellRangeAddress(1, numOfPoints, 0, 0));
|
||||
|
@ -78,9 +78,9 @@ public class BarChartExample {
|
||||
listSpeakers.add(Double.valueOf(vals[1]));
|
||||
listLanguages.add(vals[2]);
|
||||
}
|
||||
String[] categories = listLanguages.toArray(new String[listLanguages.size()]);
|
||||
Double[] values1 = listCountries.toArray(new Double[listCountries.size()]);
|
||||
Double[] values2 = listSpeakers.toArray(new Double[listSpeakers.size()]);
|
||||
String[] categories = listLanguages.toArray(new String[0]);
|
||||
Double[] values1 = listCountries.toArray(new Double[0]);
|
||||
Double[] values2 = listSpeakers.toArray(new Double[0]);
|
||||
|
||||
try (XWPFDocument doc = new XWPFDocument(argIS)) {
|
||||
XWPFChart chart = doc.getCharts().get(0);
|
||||
|
@ -80,9 +80,9 @@ public class ChartFromScratch {
|
||||
listLanguages.add(vals[2]);
|
||||
}
|
||||
|
||||
String[] categories = listLanguages.toArray(new String[listLanguages.size()]);
|
||||
Double[] values1 = listCountries.toArray(new Double[listCountries.size()]);
|
||||
Double[] values2 = listSpeakers.toArray(new Double[listSpeakers.size()]);
|
||||
String[] categories = listLanguages.toArray(new String[0]);
|
||||
Double[] values1 = listCountries.toArray(new Double[0]);
|
||||
Double[] values2 = listSpeakers.toArray(new Double[0]);
|
||||
|
||||
try (XWPFDocument doc = new XWPFDocument()) {
|
||||
XWPFChart chart = doc.createChart(XDDFChart.DEFAULT_WIDTH, XDDFChart.DEFAULT_HEIGHT);
|
||||
|
@ -219,7 +219,7 @@ public final class EscherDggRecord extends EscherRecord {
|
||||
* @return the file id clusters
|
||||
*/
|
||||
public FileIdCluster[] getFileIdClusters() {
|
||||
return field_5_fileIdClusters.toArray(new FileIdCluster[field_5_fileIdClusters.size()]);
|
||||
return field_5_fileIdClusters.toArray(new FileIdCluster[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,7 @@ public class Vector {
|
||||
}
|
||||
values.add(value);
|
||||
}
|
||||
_values = values.toArray(new TypedPropertyValue[values.size()]);
|
||||
_values = values.toArray(new TypedPropertyValue[0]);
|
||||
}
|
||||
|
||||
public TypedPropertyValue[] getValues(){
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.apache.poi.hssf.eventusermodel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.hssf.model.HSSFFormulaParser;
|
||||
@ -69,9 +70,7 @@ public class EventWorkbookBuilder {
|
||||
|
||||
// Core Workbook records go first
|
||||
if(bounds != null) {
|
||||
for (BoundSheetRecord bound : bounds) {
|
||||
wbRecords.add(bound);
|
||||
}
|
||||
Collections.addAll(wbRecords, bounds);
|
||||
}
|
||||
if(sst != null) {
|
||||
wbRecords.add(sst);
|
||||
@ -82,9 +81,7 @@ public class EventWorkbookBuilder {
|
||||
if(externs != null) {
|
||||
wbRecords.add(SupBookRecord.createInternalReferences(
|
||||
(short)externs.length));
|
||||
for (ExternSheetRecord extern : externs) {
|
||||
wbRecords.add(extern);
|
||||
}
|
||||
Collections.addAll(wbRecords, externs);
|
||||
}
|
||||
|
||||
// Finally we need an EoF record
|
||||
@ -125,12 +122,12 @@ public class EventWorkbookBuilder {
|
||||
|
||||
public BoundSheetRecord[] getBoundSheetRecords() {
|
||||
return boundSheetRecords.toArray(
|
||||
new BoundSheetRecord[boundSheetRecords.size()]
|
||||
new BoundSheetRecord[0]
|
||||
);
|
||||
}
|
||||
public ExternSheetRecord[] getExternSheetRecords() {
|
||||
return externSheetRecords.toArray(
|
||||
new ExternSheetRecord[externSheetRecords.size()]
|
||||
new ExternSheetRecord[0]
|
||||
);
|
||||
}
|
||||
public SSTRecord getSSTRecord() {
|
||||
|
@ -55,12 +55,9 @@ public class HSSFRequest {
|
||||
* for example req.addListener(myListener, BOFRecord.sid)
|
||||
*/
|
||||
public void addListener(HSSFListener lsnr, short sid) {
|
||||
List<HSSFListener> list = _records.get(Short.valueOf(sid));
|
||||
List<HSSFListener> list = _records.computeIfAbsent(Short.valueOf(sid), k -> new ArrayList<>(1));
|
||||
|
||||
if (list == null) {
|
||||
list = new ArrayList<>(1); // probably most people will use one listener
|
||||
_records.put(Short.valueOf(sid), list);
|
||||
}
|
||||
// probably most people will use one listener
|
||||
list.add(lsnr);
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ public final class ExtSSTRecord extends ContinuableRecord {
|
||||
in.nextRecord();
|
||||
}
|
||||
}
|
||||
_sstInfos = lst.toArray(new InfoSubRecord[lst.size()]);
|
||||
_sstInfos = lst.toArray(new InfoSubRecord[0]);
|
||||
}
|
||||
|
||||
public void setNumStringsPerBucket(short numStrings) {
|
||||
|
@ -77,8 +77,7 @@ public final class GroupMarkerSubRecord extends SubRecord implements Cloneable {
|
||||
public GroupMarkerSubRecord clone() {
|
||||
GroupMarkerSubRecord rec = new GroupMarkerSubRecord();
|
||||
rec.reserved = new byte[reserved.length];
|
||||
for ( int i = 0; i < reserved.length; i++ )
|
||||
rec.reserved[i] = reserved[i];
|
||||
System.arraycopy(reserved, 0, rec.reserved, 0, reserved.length);
|
||||
return rec;
|
||||
}
|
||||
}
|
||||
|
@ -159,9 +159,7 @@ public final class HyperlinkRecord extends StandardRecord implements Cloneable {
|
||||
int d0 = (parseShort(cc, 0) << 16) + (parseShort(cc, 4) << 0);
|
||||
int d1 = parseShort(cc, 9);
|
||||
int d2 = parseShort(cc, 14);
|
||||
for (int i = 23; i > 19; i--) {
|
||||
cc[i] = cc[i - 1];
|
||||
}
|
||||
System.arraycopy(cc, 19, cc, 20, 4);
|
||||
long d3 = parseLELong(cc, 20);
|
||||
|
||||
return new GUID(d0, d1, d2, d3);
|
||||
|
@ -18,6 +18,7 @@
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.util.LittleEndianOutput;
|
||||
@ -40,9 +41,7 @@ public final class PaletteRecord extends StandardRecord {
|
||||
public PaletteRecord() {
|
||||
PColor[] defaultPalette = createDefaultPalette();
|
||||
_colors = new ArrayList<>(defaultPalette.length);
|
||||
for (PColor element : defaultPalette) {
|
||||
_colors.add(element);
|
||||
}
|
||||
Collections.addAll(_colors, defaultPalette);
|
||||
}
|
||||
|
||||
public PaletteRecord(RecordInputStream in) {
|
||||
|
@ -195,7 +195,7 @@ public final class RowRecordsAggregate extends RecordAggregate {
|
||||
int startIndex = block * DBCellRecord.BLOCK_SIZE;
|
||||
|
||||
if (_rowRecordValues == null) {
|
||||
_rowRecordValues = _rowRecords.values().toArray(new RowRecord[_rowRecords.size()]);
|
||||
_rowRecordValues = _rowRecords.values().toArray(new RowRecord[0]);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -212,7 +212,7 @@ public final class RowRecordsAggregate extends RecordAggregate {
|
||||
endIndex = _rowRecords.size()-1;
|
||||
|
||||
if (_rowRecordValues == null){
|
||||
_rowRecordValues = _rowRecords.values().toArray(new RowRecord[_rowRecords.size()]);
|
||||
_rowRecordValues = _rowRecords.values().toArray(new RowRecord[0]);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -273,7 +273,7 @@ public final class HSSFChart {
|
||||
}
|
||||
}
|
||||
|
||||
return charts.toArray( new HSSFChart[charts.size()] );
|
||||
return charts.toArray(new HSSFChart[0]);
|
||||
}
|
||||
|
||||
/** Get the X offset of the chart */
|
||||
@ -298,7 +298,7 @@ public final class HSSFChart {
|
||||
* Returns the series of the chart
|
||||
*/
|
||||
public HSSFSeries[] getSeries() {
|
||||
return series.toArray(new HSSFSeries[series.size()]);
|
||||
return series.toArray(new HSSFSeries[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1153,7 +1153,7 @@ public final class HSSFChart {
|
||||
}
|
||||
}
|
||||
|
||||
linkedDataRecord.setFormulaOfLink(ptgList.toArray(new Ptg[ptgList.size()]));
|
||||
linkedDataRecord.setFormulaOfLink(ptgList.toArray(new Ptg[0]));
|
||||
|
||||
return rowCount * colCount;
|
||||
}
|
||||
|
@ -122,10 +122,7 @@ public class POIFSDocumentPath
|
||||
this.components =
|
||||
new String[ path.components.length + components.length ];
|
||||
}
|
||||
for (int j = 0; j < path.components.length; j++)
|
||||
{
|
||||
this.components[ j ] = path.components[ j ];
|
||||
}
|
||||
System.arraycopy(path.components, 0, this.components, 0, path.components.length);
|
||||
if (components != null)
|
||||
{
|
||||
for (int j = 0; j < components.length; j++)
|
||||
|
@ -154,11 +154,7 @@ public class CellFormat {
|
||||
* @return A {@link CellFormat} that applies the given format.
|
||||
*/
|
||||
public static synchronized CellFormat getInstance(Locale locale, String format) {
|
||||
Map<String, CellFormat> formatMap = formatCache.get(locale);
|
||||
if (formatMap == null) {
|
||||
formatMap = new WeakHashMap<>();
|
||||
formatCache.put(locale, formatMap);
|
||||
}
|
||||
Map<String, CellFormat> formatMap = formatCache.computeIfAbsent(locale, k -> new WeakHashMap<>());
|
||||
CellFormat fmt = formatMap.get(format);
|
||||
if (fmt == null) {
|
||||
if (format.equals("General") || format.equals("@"))
|
||||
|
@ -71,7 +71,7 @@ public final class CollaboratingWorkbooksEnvironment {
|
||||
throw new IllegalArgumentException("Must provide at least one collaborating worbook");
|
||||
}
|
||||
WorkbookEvaluator[] evaluators =
|
||||
evaluatorsByName.values().toArray(new WorkbookEvaluator[evaluatorsByName.size()]);
|
||||
evaluatorsByName.values().toArray(new WorkbookEvaluator[0]);
|
||||
new CollaboratingWorkbooksEnvironment(evaluatorsByName, evaluators);
|
||||
}
|
||||
public static void setupFormulaEvaluator(Map<String,FormulaEvaluator> evaluators) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.poi.ss.formula;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@ -94,9 +95,7 @@ final class FormulaCellCacheEntry extends CellCacheEntry {
|
||||
usedSet = Collections.emptySet();
|
||||
} else {
|
||||
usedSet = new HashSet<>(nUsed * 3 / 2);
|
||||
for (int i = 0; i < nUsed; i++) {
|
||||
usedSet.add(usedCells[i]);
|
||||
}
|
||||
usedSet.addAll(Arrays.asList(usedCells).subList(0, nUsed));
|
||||
}
|
||||
for (int i = 0; i < nPrevUsed; i++) {
|
||||
CellCacheEntry prevUsed = prevUsedCells[i];
|
||||
@ -121,4 +120,4 @@ final class FormulaCellCacheEntry extends CellCacheEntry {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,6 +141,6 @@ public class Subtotal implements Function {
|
||||
}
|
||||
}
|
||||
|
||||
return innerFunc.evaluate(list.toArray(new ValueEval[list.size()]), srcRowIndex, srcColumnIndex);
|
||||
return innerFunc.evaluate(list.toArray(new ValueEval[0]), srcRowIndex, srcColumnIndex);
|
||||
}
|
||||
}
|
||||
|
@ -149,9 +149,7 @@ public final class Trend implements Function {
|
||||
}
|
||||
double[] oneD = new double[twoD.length * twoD[0].length];
|
||||
for (int i = 0; i < twoD.length; i++) {
|
||||
for (int j = 0; j < twoD[0].length; j++) {
|
||||
oneD[i * twoD[0].length + j] = twoD[i][j];
|
||||
}
|
||||
System.arraycopy(twoD[i], 0, oneD, i * twoD[0].length + 0, twoD[0].length);
|
||||
}
|
||||
return oneD;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package org.apache.poi.ss.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -173,9 +174,7 @@ public final class CellRangeUtil {
|
||||
}
|
||||
private static List<CellRangeAddress> toList(CellRangeAddress[] temp) {
|
||||
List<CellRangeAddress> result = new ArrayList<>(temp.length);
|
||||
for (CellRangeAddress range : temp) {
|
||||
result.add(range);
|
||||
}
|
||||
Collections.addAll(result, temp);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ public class HexRead {
|
||||
}
|
||||
}
|
||||
}
|
||||
Byte[] polished = bytes.toArray(new Byte[bytes.size()]);
|
||||
Byte[] polished = bytes.toArray(new Byte[0]);
|
||||
byte[] rval = new byte[polished.length];
|
||||
for ( int j = 0; j < polished.length; j++ ) {
|
||||
rval[j] = polished[j].byteValue();
|
||||
|
@ -125,9 +125,7 @@ public class RelationshipTransformService extends TransformService {
|
||||
throw new InvalidAlgorithmParameterException();
|
||||
}
|
||||
RelationshipTransformParameterSpec relParams = (RelationshipTransformParameterSpec) params;
|
||||
for (String sourceId : relParams.sourceIds) {
|
||||
this.sourceIds.add(sourceId);
|
||||
}
|
||||
this.sourceIds.addAll(relParams.sourceIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -365,7 +365,7 @@ public class XDDFTextRun {
|
||||
.map(font -> new XDDFFont(FontGroup.SYMBOL, font))
|
||||
.ifPresent(font -> list.add(font));
|
||||
|
||||
return list.toArray(new XDDFFont[list.size()]);
|
||||
return list.toArray(new XDDFFont[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -312,9 +312,7 @@ public class XSSFBSheetHandler extends XSSFBParser {
|
||||
b0 &= ~(1<<1);
|
||||
|
||||
rkBuffer[4] = b0;
|
||||
for (int i = 1; i < 4; i++) {
|
||||
rkBuffer[i+4] = data[offset+i];
|
||||
}
|
||||
System.arraycopy(data, offset + 1, rkBuffer, 5, 3);
|
||||
double d = 0.0;
|
||||
if (floatingPoint) {
|
||||
d = LittleEndian.getDouble(rkBuffer);
|
||||
|
@ -61,7 +61,7 @@ public class XSSFConditionalFormatting implements ConditionalFormatting {
|
||||
lst.add(CellRangeAddress.valueOf(region));
|
||||
}
|
||||
}
|
||||
return lst.toArray(new CellRangeAddress[lst.size()]);
|
||||
return lst.toArray(new CellRangeAddress[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -445,7 +445,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
||||
}
|
||||
|
||||
public XWPFHyperlink[] getHyperlinks() {
|
||||
return hyperlinks.toArray(new XWPFHyperlink[hyperlinks.size()]);
|
||||
return hyperlinks.toArray(new XWPFHyperlink[0]);
|
||||
}
|
||||
|
||||
public XWPFComment getCommentByID(String id) {
|
||||
@ -459,7 +459,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
||||
}
|
||||
|
||||
public XWPFComment[] getComments() {
|
||||
return comments.toArray(new XWPFComment[comments.size()]);
|
||||
return comments.toArray(new XWPFComment[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1423,11 +1423,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
||||
}
|
||||
|
||||
void registerPackagePictureData(XWPFPictureData picData) {
|
||||
List<XWPFPictureData> list = packagePictures.get(picData.getChecksum());
|
||||
if (list == null) {
|
||||
list = new ArrayList<>(1);
|
||||
packagePictures.put(picData.getChecksum(), list);
|
||||
}
|
||||
List<XWPFPictureData> list = packagePictures.computeIfAbsent(picData.getChecksum(), k -> new ArrayList<>(1));
|
||||
if (!list.contains(picData)) {
|
||||
list.add(picData);
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ public final class Chunk {
|
||||
|
||||
// Save the commands we liked the look of
|
||||
this.commands = commandList.toArray(
|
||||
new Command[commandList.size()] );
|
||||
new Command[0]);
|
||||
|
||||
// Now build up the blocks, if we had a command that tells
|
||||
// us where a block is
|
||||
|
@ -109,7 +109,7 @@ public final class ChunkFactory {
|
||||
defsL.add(def);
|
||||
}
|
||||
|
||||
CommandDefinition[] defs = defsL.toArray(new CommandDefinition[defsL.size()]);
|
||||
CommandDefinition[] defs = defsL.toArray(new CommandDefinition[0]);
|
||||
|
||||
// Add to the map
|
||||
chunkCommandDefinitions.put(Integer.valueOf(chunkType), defs);
|
||||
|
@ -76,6 +76,6 @@ public final class ChunkStream extends Stream {
|
||||
logger.log(POILogger.ERROR, "Failed to create chunk at " + pos + ", ignoring rest of data." + e);
|
||||
}
|
||||
|
||||
chunks = chunksA.toArray(new Chunk[chunksA.size()]);
|
||||
chunks = chunksA.toArray(new Chunk[0]);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public abstract class EscherPart extends HPBFPart {
|
||||
ec.add(er);
|
||||
}
|
||||
|
||||
records = ec.toArray(new EscherRecord[ec.size()]);
|
||||
records = ec.toArray(new EscherRecord[0]);
|
||||
}
|
||||
|
||||
public EscherRecord[] getEscherRecords() {
|
||||
|
@ -50,7 +50,7 @@ public class ExObjList extends RecordContainer {
|
||||
}
|
||||
}
|
||||
|
||||
return links.toArray(new ExHyperlink[links.size()]);
|
||||
return links.toArray(new ExHyperlink[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,8 +82,8 @@ public final class MainMaster extends SheetContainer {
|
||||
}
|
||||
|
||||
}
|
||||
txmasters = tx.toArray(new TxMasterStyleAtom[tx.size()]);
|
||||
clrscheme = clr.toArray(new ColorSchemeAtom[clr.size()]);
|
||||
txmasters = tx.toArray(new TxMasterStyleAtom[0]);
|
||||
clrscheme = clr.toArray(new ColorSchemeAtom[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,7 +149,7 @@ public abstract class Record implements GenericRecord
|
||||
}
|
||||
|
||||
// Turn the vector into an array, and return
|
||||
return children.toArray( new Record[children.size()] );
|
||||
return children.toArray(new Record[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,7 +150,7 @@ public abstract class RecordContainer extends Record
|
||||
rm = r;
|
||||
}
|
||||
}
|
||||
_children = lst.toArray(new Record[lst.size()]);
|
||||
_children = lst.toArray(new Record[0]);
|
||||
return rm;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ public final class SlideListWithText extends RecordContainer {
|
||||
}
|
||||
|
||||
// Turn the list into an array
|
||||
slideAtomsSets = sets.toArray( new SlideAtomsSet[sets.size()] );
|
||||
slideAtomsSets = sets.toArray(new SlideAtomsSet[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +91,7 @@ public final class StyleTextProp9Atom extends RecordAtom {
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.autoNumberSchemes = schemes.toArray(new TextPFException9[schemes.size()]);
|
||||
this.autoNumberSchemes = schemes.toArray(new TextPFException9[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,4 +155,4 @@ public final class StyleTextProp9Atom extends RecordAtom {
|
||||
"autoNumberSchemes", this::getAutoNumberTypes
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ public final class TextSpecInfoAtom extends RecordAtom {
|
||||
while (bis.getReadIndex() < _data.length) {
|
||||
lst.add(new TextSpecInfoRun(bis));
|
||||
}
|
||||
return lst.toArray(new TextSpecInfoRun[lst.size()]);
|
||||
return lst.toArray(new TextSpecInfoRun[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -452,7 +452,7 @@ public class HSLFSlideShowEncrypted implements Closeable {
|
||||
recordMap.remove(oldOffset);
|
||||
}
|
||||
|
||||
return recordMap.values().toArray(new Record[recordMap.size()]);
|
||||
return recordMap.values().toArray(new Record[0]);
|
||||
}
|
||||
|
||||
|
||||
@ -496,7 +496,7 @@ public class HSLFSlideShowEncrypted implements Closeable {
|
||||
|
||||
uea.setMaxPersistWritten(maxSlideId);
|
||||
|
||||
records = recordList.toArray(new Record[recordList.size()]);
|
||||
records = recordList.toArray(new Record[0]);
|
||||
|
||||
return records;
|
||||
}
|
||||
|
@ -89,6 +89,6 @@ public final class HSLFSoundData {
|
||||
}
|
||||
|
||||
}
|
||||
return lst.toArray(new HSLFSoundData[lst.size()]);
|
||||
return lst.toArray(new HSLFSoundData[0]);
|
||||
}
|
||||
}
|
||||
|
@ -167,8 +167,8 @@ public class MAPIMessage extends POIReadOnlyDocument {
|
||||
attachments.add( (AttachmentChunks)group );
|
||||
}
|
||||
}
|
||||
attachmentChunks = attachments.toArray(new AttachmentChunks[attachments.size()]);
|
||||
recipientChunks = recipients.toArray(new RecipientChunks[recipients.size()]);
|
||||
attachmentChunks = attachments.toArray(new AttachmentChunks[0]);
|
||||
recipientChunks = recipients.toArray(new RecipientChunks[0]);
|
||||
|
||||
// Now sort these chunks lists so they're in ascending order,
|
||||
// rather than in random filesystem order
|
||||
|
@ -98,7 +98,7 @@ public class AttachmentChunks implements ChunkGroup {
|
||||
}
|
||||
|
||||
public Chunk[] getAll() {
|
||||
return allChunks.toArray(new Chunk[allChunks.size()]);
|
||||
return allChunks.toArray(new Chunk[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,7 +110,7 @@ public final class Chunks implements ChunkGroupWithProperties {
|
||||
for (List<Chunk> c : allChunks.values()) {
|
||||
chunks.addAll(c);
|
||||
}
|
||||
return chunks.toArray(new Chunk[chunks.size()]);
|
||||
return chunks.toArray(new Chunk[0]);
|
||||
}
|
||||
|
||||
public StringChunk getMessageClass() {
|
||||
@ -239,9 +239,7 @@ public final class Chunks implements ChunkGroupWithProperties {
|
||||
}
|
||||
|
||||
// And add to the main list
|
||||
if (allChunks.get(prop) == null) {
|
||||
allChunks.put(prop, new ArrayList<>());
|
||||
}
|
||||
allChunks.computeIfAbsent(prop, k -> new ArrayList<>());
|
||||
allChunks.get(prop).add(chunk);
|
||||
}
|
||||
|
||||
@ -254,4 +252,4 @@ public final class Chunks implements ChunkGroupWithProperties {
|
||||
"Message didn't contain a root list of properties!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public final class NameIdChunks implements ChunkGroup {
|
||||
private List<Chunk> allChunks = new ArrayList<>();
|
||||
|
||||
public Chunk[] getAll() {
|
||||
return allChunks.toArray(new Chunk[allChunks.size()]);
|
||||
return allChunks.toArray(new Chunk[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -172,7 +172,7 @@ public final class RecipientChunks implements ChunkGroupWithProperties {
|
||||
}
|
||||
|
||||
public Chunk[] getAll() {
|
||||
return allChunks.toArray(new Chunk[allChunks.size()]);
|
||||
return allChunks.toArray(new Chunk[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -99,7 +99,7 @@ public final class POIFSChunkParser {
|
||||
}
|
||||
|
||||
// Finish
|
||||
return groups.toArray(new ChunkGroup[groups.size()]);
|
||||
return groups.toArray(new ChunkGroup[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,7 +79,7 @@ public class AbstractWordUtils
|
||||
}
|
||||
}
|
||||
|
||||
Integer[] sorted = edges.toArray( new Integer[edges.size()] );
|
||||
Integer[] sorted = edges.toArray(new Integer[0]);
|
||||
int[] result = new int[sorted.length];
|
||||
for ( int i = 0; i < sorted.length; i++ )
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ public class BookmarksTables
|
||||
}
|
||||
|
||||
int start = tableStream.size();
|
||||
SttbUtils.writeSttbfBkmk( names.toArray( new String[names.size()] ),
|
||||
SttbUtils.writeSttbfBkmk( names.toArray(new String[0]),
|
||||
tableStream );
|
||||
int end = tableStream.size();
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class ComplexFileTable {
|
||||
SprmBuffer sprmBuffer = new SprmBuffer(bs, false, 0);
|
||||
sprmBuffers.add(sprmBuffer);
|
||||
}
|
||||
this._grpprls = sprmBuffers.toArray(new SprmBuffer[sprmBuffers.size()]);
|
||||
this._grpprls = sprmBuffers.toArray(new SprmBuffer[0]);
|
||||
|
||||
if (tableStream[offset] != TEXT_PIECE_TABLE_TYPE) {
|
||||
throw new IOException("The text piece table is corrupted");
|
||||
|
@ -84,7 +84,7 @@ public final class FSPATable
|
||||
{
|
||||
result.add( new FSPA( propertyNode.getBytes(), 0 ) );
|
||||
}
|
||||
return result.toArray( new FSPA[result.size()] );
|
||||
return result.toArray(new FSPA[0]);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
|
@ -57,7 +57,7 @@ public final class OldFontTable {
|
||||
startOffset += oldFfn.getLength();
|
||||
|
||||
}
|
||||
_fontNames = ffns.toArray(new OldFfn[ffns.size()]);
|
||||
_fontNames = ffns.toArray(new OldFfn[0]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,7 +163,7 @@ public final class PlexOfCps {
|
||||
if (_props == null || _props.isEmpty())
|
||||
return new GenericPropertyNode[0];
|
||||
|
||||
return _props.toArray(new GenericPropertyNode[_props.size()]);
|
||||
return _props.toArray(new GenericPropertyNode[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -231,12 +231,7 @@ public class BookmarksImpl implements Bookmarks
|
||||
GenericPropertyNode property = bookmarksTables
|
||||
.getDescriptorFirst( b );
|
||||
Integer positionKey = Integer.valueOf( property.getStart() );
|
||||
List<GenericPropertyNode> atPositionList = result.get( positionKey );
|
||||
if ( atPositionList == null )
|
||||
{
|
||||
atPositionList = new LinkedList<>();
|
||||
result.put( positionKey, atPositionList );
|
||||
}
|
||||
List<GenericPropertyNode> atPositionList = result.computeIfAbsent(positionKey, k -> new LinkedList<>());
|
||||
atPositionList.add( property );
|
||||
}
|
||||
|
||||
|
@ -235,6 +235,6 @@ public final class TestTxMasterStyleAtom extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
return lst.toArray(new TxMasterStyleAtom[lst.size()]);
|
||||
return lst.toArray(new TxMasterStyleAtom[0]);
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public final class TestColumnInfoRecordsAggregate {
|
||||
public static ColumnInfoRecord[] getRecords(ColumnInfoRecordsAggregate agg) {
|
||||
CIRCollector circ = new CIRCollector();
|
||||
agg.visitContainedRecords(circ);
|
||||
return circ._list.toArray(new ColumnInfoRecord[circ._list.size()]);
|
||||
return circ._list.toArray(new ColumnInfoRecord[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,10 +49,7 @@ public final class TestPOIFSDocumentPath extends TestCase {
|
||||
{
|
||||
String[] params = new String[ j ];
|
||||
|
||||
for (int k = 0; k < j; k++)
|
||||
{
|
||||
params[ k ] = components[ k ];
|
||||
}
|
||||
System.arraycopy(components, 0, params, 0, j);
|
||||
POIFSDocumentPath path = new POIFSDocumentPath(params);
|
||||
|
||||
assertEquals(j, path.length());
|
||||
@ -116,10 +113,7 @@ public final class TestPOIFSDocumentPath extends TestCase {
|
||||
{
|
||||
String[] initialParams = new String[ n ];
|
||||
|
||||
for (int k = 0; k < n; k++)
|
||||
{
|
||||
initialParams[ k ] = initialComponents[ k ];
|
||||
}
|
||||
System.arraycopy(initialComponents, 0, initialParams, 0, n);
|
||||
POIFSDocumentPath base =
|
||||
new POIFSDocumentPath(initialParams);
|
||||
String[] components =
|
||||
@ -131,10 +125,7 @@ public final class TestPOIFSDocumentPath extends TestCase {
|
||||
{
|
||||
String[] params = new String[ j ];
|
||||
|
||||
for (int k = 0; k < j; k++)
|
||||
{
|
||||
params[ k ] = components[ k ];
|
||||
}
|
||||
System.arraycopy(components, 0, params, 0, j);
|
||||
POIFSDocumentPath path = new POIFSDocumentPath(base, params);
|
||||
|
||||
assertEquals(j + n, path.length());
|
||||
|
Loading…
x
Reference in New Issue
Block a user