Browse Source

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
tags/REL_3_15_BETA2
Javen O'Neal 8 years ago
parent
commit
72de4d1a63
1 changed files with 5 additions and 4 deletions
  1. 5
    4
      src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java

+ 5
- 4
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java 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) {

Loading…
Cancel
Save