diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java index 068f5465c3..5a1351f385 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java @@ -537,5 +537,25 @@ public class SXSSFRow implements Row, Comparable Integer otherRow = other.getRowNum(); return thisRow.compareTo(otherRow); } + + @Override + public boolean equals(Object obj) + { + if (!(obj instanceof SXSSFRow)) + { + return false; + } + SXSSFRow other = (SXSSFRow) obj; + + return (this.getRowNum() == other.getRowNum()) && + (this.getSheet() == other.getSheet()); + } + + @Override + public int hashCode() { + return (getSheet().hashCode() << 16) + getRowNum(); + } + + } diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java index 7f5fe0b545..14680572e3 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java @@ -149,6 +149,24 @@ public class XSSFRow implements Row, Comparable { return thisRow.compareTo(otherRow); } + @Override + public boolean equals(Object obj) + { + if (!(obj instanceof XSSFRow)) + { + return false; + } + XSSFRow other = (XSSFRow) obj; + + return (this.getRowNum() == other.getRowNum()) && + (this.getSheet() == other.getSheet()); + } + + @Override + public int hashCode() { + return _row.hashCode(); + } + /** * Use this to create new cells within the row and return it. *