--- old/src/java.base/share/classes/java/lang/StringUTF16.java 2016-03-09 16:26:47.281048243 +0100 +++ new/src/java.base/share/classes/java/lang/StringUTF16.java 2016-03-09 16:26:47.190047742 +0100 @@ -292,6 +292,20 @@ return len1 - len2; } + /** + * hashCode consistent with {@link #compareToCI} + */ + public static int hashCodeCI(byte[] value) { + int len = length(value); + int h = 0; + for (int k = 0; k < len; k++) { + char cu = (char) CharacterDataLatin1.instance.toUpperCase(getChar(value, k)); + char cl = (char) CharacterDataLatin1.instance.toLowerCase(cu); + h = 31 * h + cl; + } + return h; + } + public static int compareToCI_Latin1(byte[] value, byte[] other) { int len1 = length(value); int len2 = StringLatin1.length(other);