class Feline
{
String name;
int age;
equals(Object obj) {...}
hashCode(){...}
}
class Cat extends Feline
{
int teeth;
hashCode(){...}
equals(Object obj)
{
if (!super.equals(obj))
{
return false; //If I don't want this should I use
}
...
}
}
class Bar extends Foo {
public boolean equals(Object other) {
if (other instanceof Bar) {
Bar that = (Bar)other;
return that.canEqual(this) && otherStuff;
}
return false;
}
public boolean canEqual(Object other) {
return other instanceof Bar;
}
}