bug 57840: make it easier to replace _rows implementation (HashMap?) by making it final

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1748482 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-06-15 02:56:56 +00:00
parent 4bebb8f816
commit 72de4d1a63
1 changed files with 5 additions and 4 deletions

View File

@ -110,7 +110,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
protected CTSheet sheet;
protected CTWorksheet worksheet;
private SortedMap<Integer, XSSFRow> _rows;
private final SortedMap<Integer, XSSFRow> _rows = new TreeMap<Integer, XSSFRow>();
private List<XSSFHyperlink> hyperlinks;
private ColumnHelper columnHelper;
private CommentsTable sheetComments;
@ -216,7 +216,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
}
private void initRows(CTWorksheet worksheetParam) {
_rows = new TreeMap<Integer, XSSFRow>();
_rows.clear();
tables = new TreeMap<String, XSSFTable>();
sharedFormulas = new HashMap<Integer, CTCellFormula>();
arrayFormulas = new ArrayList<CellRangeAddress>();
@ -3024,13 +3024,14 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
rowShifter.updateHyperlinks(shifter);
//rebuild the _rows map
SortedMap<Integer, XSSFRow> map = new TreeMap<Integer, XSSFRow>();
Map<Integer, XSSFRow> map = new HashMap<Integer, XSSFRow>();
for(XSSFRow r : _rows.values()) {
// 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;
_rows.clear();
_rows.putAll(map);
}
private int shiftedRowNum(int startRow, int endRow, int n, int rownum) {