aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaven O'Neal <onealj@apache.org>2016-06-11 11:40:30 +0000
committerJaven O'Neal <onealj@apache.org>2016-06-11 11:40:30 +0000
commit370a0563e8ae0f49124511e56d1cde7504286e69 (patch)
tree8f3e5af23539791de65329d0981b1dba268c6ca9
parent460540ded26849c2e792c44ac55e164d3307a217 (diff)
downloadpoi-370a0563e8ae0f49124511e56d1cde7504286e69.tar.gz
poi-370a0563e8ae0f49124511e56d1cde7504286e69.zip
bug 57840: lazily compute hashCode; patch from Greg Woolsey
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1747881 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java
index 22e1449db1..a0cd24d450 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java
@@ -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;
}