poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fannin...@apache.org
Subject svn commit: r1835494 - /poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
Date Mon, 09 Jul 2018 20:49:21 GMT
Author: fanningpj
Date: Mon Jul  9 20:49:21 2018
New Revision: 1835494

URL: http://svn.apache.org/viewvc?rev=1835494&view=rev
Log:
more usage of shared rebuildRows

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=1835494&r1=1835493&r2=1835494&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Mon Jul  9 20:49:21
2018
@@ -3171,17 +3171,9 @@ public class XSSFSheet extends POIXMLDoc
             entry.getKey().setRow(entry.getValue());
         }
 
-        //rebuild the _rows map
-        Map<Integer, XSSFRow> map = new HashMap<>();
-        for(XSSFRow r : _rows.values()) {
-            // Performance optimization: explicit boxing is slightly faster than auto-unboxing,
though may use more memory
-            final Integer rownumI = Integer.valueOf(r.getRowNum()); // NOSONAR
-            map.put(rownumI, r);
-        }
-        _rows.clear();
-        _rows.putAll(map);
-
+        rebuildRows();
     }
+
     private int shiftedRowNum(int startRow, int endRow, int n, int rownum) {
         // no change if before any affected row
         if(rownum < startRow && (n > 0 || (startRow - rownum) > n)) {
@@ -3208,6 +3200,7 @@ public class XSSFSheet extends POIXMLDoc
         // row is part of the shifted block
         return rownum + n;
     }
+
     private void shiftCommentsForColumns(XSSFVMLDrawing vml, int startColumnIndex, int endColumnIndex,
final int n){
         // then do the actual moving and also adjust comments/rowHeight
         // we need to sort it in a way so the shifting does not mess up the structures, 
@@ -3257,16 +3250,7 @@ public class XSSFSheet extends POIXMLDoc
             entry.getKey().setColumn(entry.getValue());
         }
 
-        //rebuild the _rows map
-        Map<Integer, XSSFRow> map = new HashMap<>();
-        for(XSSFRow r : _rows.values()) {
-            // Performance optimization: explicit boxing is slightly faster than auto-unboxing,
though may use more memory
-            final Integer rownumI = Integer.valueOf(r.getRowNum()); // NOSONAR
-            map.put(rownumI, r);
-        }
-        _rows.clear();
-        _rows.putAll(map);
-
+        rebuildRows();
     }
 
     /**
@@ -3631,8 +3615,10 @@ public class XSSFSheet extends POIXMLDoc
             }*/
         }
 
-        int minCell=Integer.MAX_VALUE, maxCell=Integer.MIN_VALUE;
-        for(XSSFRow row : _rows.values()){
+        int minCell = Integer.MAX_VALUE, maxCell = Integer.MIN_VALUE;
+        for(Map.Entry<Integer, XSSFRow> entry : _rows.entrySet()) {
+            XSSFRow row = entry.getValue();
+
             // first perform the normal write actions for the row
             row.onDocumentWrite();
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message