The Object class has a number of methods such as equals, hashCode, notify, wait etc.
What methods do you think are missing from the Object class and why? Are there any additional methods you wish it had?
The Object class has a number of methods such as equals, hashCode, notify, wait etc.
What methods do you think are missing from the Object class and why? Are there any additional methods you wish it had?
I don't think it should have any extra methods... in fact, I think various methods that are there shouldn't be there in the first place.
One problem in Java is that a lot of types (such as HashMap
) always use the hash code and equality methods on the keys directly - it would be much better if Java had an interface like .NET's IEqualityComparer<T>
that anything wanting to perform hashing/equality comparisons could delegate to.