@Override public long longHash(String s, LongHashFunction hashFunction, int off, int len) { return hashFunction.hashNativeChars(s, off, len); } }
/** * Shortcut for {@link #hashChars(StringBuilder, int, int) hashChars(input, 0, input.length())}. */ public long hashChars(@NotNull StringBuilder input) { return hashNativeChars(input); }
long hashNativeChars(CharSequence input) { return hashNativeChars(input, 0, input.length()); }
/** * Returns the hash code for bytes of the specified subsequence of the given * {@code StringBuilder}'s underlying {@code char} array. * * <p>Default implementation could either delegate to {@link #hash(Object, Access, long, long)} * using {@link Access#toNativeCharSequence()}, or to {@link #hashChars(char[], int, int)}. * * @param input the string builder which bytes to hash * @param off index of the first {@code char} in the subsequence to hash * @param len length of the subsequence to hash, in chars (i. e. the length of the bytes * sequence to hash is {@code len * 2L}) * @return the hash code of the given {@code String}'s bytes * @throws IndexOutOfBoundsException if {@code off < 0} or {@code off + len > input.length()} * or {@code len < 0} */ public long hashChars(@NotNull StringBuilder input, int off, int len) { checkArrayOffs(input.length(), off, len); return hashNativeChars(input, off, len); }