String hashCode implementation in java 11 looks like this:
public int hashCode() {
int h = hash;
if (h == 0 && value.length > 0) {
hash = h = isLatin1() ? StringLatin1.hashCode(value)
: StringUTF16.hashCode(value);
}
return h;
}
Why do we need int h
here ? Is it somehow related to thread synchronization ?