_cells = new TreeMap<Integer, XSSFCell>();
for (CTCell c : row.getCArray()) {
XSSFCell cell = new XSSFCell(this, c);
- Integer colI = new Integer(cell.getColumnIndex()); // NOSONAR
+ // Performance optimization for bug 57840: explicit boxing is slightly faster than auto-unboxing, though may use more memory
+ final Integer colI = new Integer(cell.getColumnIndex()); // NOSONAR
_cells.put(colI, cell);
sheet.onReadCell(cell);
}
* @see Cell#CELL_TYPE_STRING
*/
public XSSFCell createCell(int columnIndex, int type) {
+ // Performance optimization for bug 57840: explicit boxing is slightly faster than auto-unboxing, though may use more memory
final Integer colI = new Integer(columnIndex); // NOSONAR
CTCell ctCell;
XSSFCell prev = _cells.get(colI);
public XSSFCell getCell(int cellnum, MissingCellPolicy policy) {
if(cellnum < 0) throw new IllegalArgumentException("Cell index must be >= 0");
- Integer colI = new Integer(cellnum); // NOSONAR
+ // Performance optimization for bug 57840: explicit boxing is slightly faster than auto-unboxing, though may use more memory
+ final Integer colI = new Integer(cellnum); // NOSONAR
XSSFCell cell = _cells.get(colI);
if(policy == RETURN_NULL_AND_BLANK) {
return cell;
if(cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
_sheet.getWorkbook().onDeleteFormula(xcell);
}
- Integer colI = new Integer(cell.getColumnIndex()); // NOSONAR
+ // Performance optimization for bug 57840: explicit boxing is slightly faster than auto-unboxing, though may use more memory
+ final Integer colI = new Integer(cell.getColumnIndex()); // NOSONAR
_cells.remove(colI);
}
arrayFormulas = new ArrayList<CellRangeAddress>();
for (CTRow row : worksheetParam.getSheetData().getRowArray()) {
XSSFRow r = new XSSFRow(row, this);
- Integer rownumI = new Integer(r.getRowNum()); // NOSONAR
+ // Performance optimization: explicit boxing is slightly faster than auto-unboxing, though may use more memory
+ final Integer rownumI = new Integer(r.getRowNum()); // NOSONAR
_rows.put(rownumI, r);
}
}
*/
@Override
public XSSFRow createRow(int rownum) {
+ // Performance optimization: explicit boxing is slightly faster than auto-unboxing, though may use more memory
final Integer rownumI = new Integer(rownum); // NOSONAR
CTRow ctRow;
XSSFRow prev = _rows.get(rownumI);
*/
@Override
public XSSFRow getRow(int rownum) {
- Integer rownumI = new Integer(rownum); // NOSONAR
+ // Performance optimization: explicit boxing is slightly faster than auto-unboxing, though may use more memory
+ final Integer rownumI = new Integer(rownum); // NOSONAR
return _rows.get(rownumI);
}
}
}
else {
- Integer startI = new Integer(startRowNum); // NOSONAR
- Integer endI = new Integer(endRowNum+1); // NOSONAR
- rows.addAll(_rows.subMap(startI, endI).values());
+ // Performance optimization: explicit boxing is slightly faster than auto-unboxing, though may use more memory
+ final Integer startI = new Integer(startRowNum); // NOSONAR
+ final Integer endI = new Integer(endRowNum+1); // NOSONAR
+ final Collection<XSSFRow> inclusive = _rows.subMap(startI, endI).values();
+ rows.addAll(inclusive);
}
return rows;
}
row.removeCell(cell);
}
- Integer rownumI = new Integer(row.getRowNum()); // NOSONAR
+ // Performance optimization: explicit boxing is slightly faster than auto-unboxing, though may use more memory
+ final Integer rownumI = new Integer(row.getRowNum()); // NOSONAR
int idx = _rows.headMap(rownumI).size();
_rows.remove(rownumI);
worksheet.getSheetData().removeRow(idx);
// check if we should remove this row as it will be overwritten by the data later
if (shouldRemoveRow(startRow, endRow, n, rownum)) {
// remove row from worksheet.getSheetData row array
- Integer rownumI = new Integer(row.getRowNum()); // NOSONAR
+ // Performance optimization: explicit boxing is slightly faster than auto-unboxing, though may use more memory
+ final Integer rownumI = new Integer(row.getRowNum()); // NOSONAR
int idx = _rows.headMap(rownumI).size();
worksheet.getSheetData().removeRow(idx);
//rebuild the _rows map
SortedMap<Integer, XSSFRow> map = new TreeMap<Integer, XSSFRow>();
for(XSSFRow r : _rows.values()) {
- Integer rownumI = new Integer(r.getRowNum()); // NOSONAR
+ // Performance optimization: explicit boxing is slightly faster than auto-unboxing, though may use more memory
+ final Integer rownumI = new Integer(r.getRowNum()); // NOSONAR
map.put(rownumI, r);
}
_rows = map;