mirror of https://github.com/apache/poi.git
findbugs: add missing equals and hashCode for classes with a compareTo method
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1717068 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d471500512
commit
da8eb997cd
|
@ -537,5 +537,25 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow>
|
|||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -149,6 +149,24 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
|
|||
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.
|
||||
* <p>
|
||||
|
|
Loading…
Reference in New Issue