]> source.dussan.org Git - poi.git/commitdiff
bug 57840: lazily compute hashCode; patch from Greg Woolsey
authorJaven O'Neal <onealj@apache.org>
Sat, 11 Jun 2016 11:40:30 +0000 (11:40 +0000)
committerJaven O'Neal <onealj@apache.org>
Sat, 11 Jun 2016 11:40:30 +0000 (11:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1747881 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java

index 22e1449db1b8b0377a28c37cc4b9ad59607afa75..a0cd24d450ebdf9fad763390edece67098e3c33e 100644 (file)
@@ -62,16 +62,18 @@ final class XSSFEvaluationSheet implements EvaluationSheet {
     private static class CellKey {
         private final int _row;
         private final int _col;
-        private final int _hash;
+        private int _hash = -1; //lazily computed
         
         protected CellKey(int row, int col) {
             _row = row;
             _col = col;
-            _hash = (17 * 37 + row) * 37 + col;
         }
         
         @Override
         public int hashCode() {
+            if ( _hash == -1 ) {
+                 _hash = (17 * 37 + _row) * 37 + _col;
+            }
             return _hash;
         }