In Java, Objects.hash(null) return 0
but
Map<Integer, Integer> map = null;
Objects.hash(map)
will return 31
It is related to how varargs are interpretted. Under the hood, varargs parameters are implemented by creating an array.
In the Objects.hash(null) case, you are passing obviously literally passing null. There is no array. When you do Objects.hash(map), this is converted to an array of length 1, with null as the first and only element.
Because of the way that hash code is calculated, null and an array with 1 null element get different hash codes.
.hashCode()method. (And on a programming note: what would hashingnulleven achieve?)