The problem with using id to establish equality is that you may need to compare objects that have not yet been assigned an identifier to objects with identifiers. In this case, the equals and hashCode methods must use business fields that make the object unique (the "business key").
Also compares the class, instead of using instanceof, eliminates subclassing, as NPE says.
This code is bearable, this is not my favorite way to do something. For simple cases, it overflows, the hashCode and equal methods defined by Object will be executed. For more advanced domain models, this is inadequate, because subclasses and comparisons by business key will really be useful.
Nathan hughes
source share