On Thu, 20 Mar 2025 11:59:58 GMT, Zihao Lin <d...@openjdk.org> wrote:
> Add the java.util.Arrays.hashCode(byte[], int start, int end). > > Hi team, I am new here, please give me some guidance. Thank you. src/java.base/share/classes/java/util/Arrays.java line 4454: > 4452: */ > 4453: public static int hashCode(byte[] a, int fromIndex, int toIndex) { > 4454: if (a == null) { The `a == null` special check is dubious - `a == null` has a meaning if we are hashing a whole `byte[]` object, but with a specific `fromIndex` and `toIndex` it just doesn't work. That said, we might consider accepting the initial hash too - For example, we have two `byte[]` arrays and we want a concatenated hash. The initial hash allows us to compute such a hash from two arrays easily. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24128#discussion_r2006510085