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?

2
  • 2
    Well, it does have some null checking: The body of Objects.hashcode(Object o) is essentially: return o != null ? o.hashCode() : 0 Commented Oct 1, 2018 at 20:52
  • 2
    Yes, my Question here is indeed a duplicate of Difference between Objects.hashCode() and new Object().hashCode()?. That original escaped my searches. Thanks. And the answer is indeed tolerating NULL as commented above. Commented Oct 1, 2018 at 20:59

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.