Implement hashCode() methods.

According to the Java language specification a class overriding equals()
should also override hashCode().