hash method

int hash (Object o)

Get a hashcode of an element.

The hashcode should be compatible with equals, so that if equals(a, b) then hash(a) == hash(b).


int hash(Object o) {
  if (o is Set) return new SetEquality(this).hash(o);
  if (o is Map) return new MapEquality(keys: this, values: this).hash(o);
  if (!_unordered) {
    if (o is List) return new ListEquality(this).hash(o);
    if (o is Iterable) return new IterableEquality(this).hash(o);
  } else if (o is Iterable) {
    return new UnorderedIterableEquality(this).hash(o);
  return _base.hash(o);