0

Java 7 added the java.util.Objects class with several utility methods. One of these, Objects.hashCode returns a int hash value for the single passed Object.

What is the point of this particular method?

How is this different than just calling the superclass method Object::hashCode on the original object?

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
  • 2
    Well, it does have some null checking: The body of `Objects.hashcode(Object o)` is essentially: `return o != null ? o.hashCode() : 0` – KevinO Oct 01 '18 at 20:52
  • 2
    Yes, my Question here is indeed a duplicate of [*Difference between Objects.hashCode() and new Object().hashCode()?*](https://stackoverflow.com/q/16187453/642706). That original escaped my searches. Thanks. And the answer is indeed tolerating NULL as commented above. – Basil Bourque Oct 01 '18 at 20:59

0 Answers0