Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

deepHashCode with byte array

For some reason, Arrays.deepHashCode() cannot work with byte[].
Is there any other equivalent?

like image 793
Dig Avatar asked Dec 10 '22 11:12

Dig


1 Answers

First off, no need for "Deep". It's a primitive. You don't need Deep.

Just use Arrays.hashCode(byte[] yourArray).

Deep implies delving into the Objects contained within the array. Given that you are dealing with a primitive, you just need to use the primitive value itself in the calculation. That's why none of the Deep methods revolve around primitives.

like image 63
rfeak Avatar answered Dec 11 '22 23:12

rfeak