Note that the parameter of Objects.hash is Object.... This has two main consequences:
- Primitive values used in the hash code calculation have to be boxed, e.g.
this.idis converted fromlongtoLong. - An
Object[]has to be created to invoke the method.
The cost of creating of these “unnecessary” objects may add up if hashCode is called frequently.