hash method
override
Get a hashcode of an element.
The hashcode should be compatible with equals, so that if
equals(a, b)
then hash(a) == hash(b)
.
Implementation
int hash(Iterable<E> elements) {
if (elements == null) return null.hashCode;
// Jenkins's one-at-a-time hash function.
int hash = 0;
for (E element in elements) {
int c = _elementEquality.hash(element);
hash = (hash + c) & _HASH_MASK;
hash = (hash + (hash << 10)) & _HASH_MASK;
hash ^= (hash >> 6);
}
hash = (hash + (hash << 3)) & _HASH_MASK;
hash ^= (hash >> 11);
hash = (hash + (hash << 15)) & _HASH_MASK;
return hash;
}