Implement missing hashCode() methods

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1388070 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-09-20 15:23:20 +00:00
parent 5cf4263368
commit c96a705446
4 changed files with 41 additions and 0 deletions

View File

@ -496,6 +496,11 @@ public class StringUtilsEqualsIndexOfTest {
return seq.equals(other.seq);
}
@Override
public int hashCode() {
return seq.hashCode();
}
@Override
public String toString() {
return seq.toString();

View File

@ -49,6 +49,11 @@ public class CompareToBuilderTest {
return a == rhs.a;
}
@Override
public int hashCode() {
return a;
}
public void setA(int a) {
this.a = a;
}

View File

@ -53,6 +53,11 @@ public class EqualsBuilderTest {
return a == rhs.a;
}
@Override
public int hashCode() {
return a;
}
public void setA(int a) {
this.a = a;
}
@ -83,6 +88,11 @@ public class EqualsBuilderTest {
return super.equals(o) && b == rhs.b;
}
@Override
public int hashCode() {
return b *17 + super.hashCode();
}
public void setB(int b) {
this.b = b;
}
@ -948,6 +958,11 @@ public class EqualsBuilderTest {
return false;
}
@Override
public int hashCode() {
return a;
}
public int getA() {
return this.a;
}
@ -974,6 +989,11 @@ public class EqualsBuilderTest {
return false;
}
@Override
public int hashCode() {
return b;
}
public int getB() {
return this.b;
}

View File

@ -83,6 +83,11 @@ public class HashCodeBuilderTest {
return a == rhs.a;
}
@Override
public int hashCode() {
return a;
}
public void setA(int a) {
this.a = a;
}
@ -119,6 +124,12 @@ public class HashCodeBuilderTest {
TestSubObject rhs = (TestSubObject) o;
return super.equals(o) && b == rhs.b;
}
@Override
public int hashCode() {
return b*17 + t ;
}
}
@Test