HashSet(
{bool equals(E e1, E e2),
int hashCode(E e),
bool isValidKey(potentialKey)}
)

Create a hash set using the provided equals as equality.

The provided equals must define a stable equivalence relation, and hashCode must be consistent with equals. If the equals or hashCode methods won't work on all objects, but only to instances of E, the isValidKey predicate can be used to restrict the keys that they are applied to. Any key for which isValidKey returns false is automatically assumed to not be in the set.

If equals or hashCode are omitted, the set uses the objects' intrinsic Object.operator== and Object.hashCode.

If isValidKey is omitted, it defaults to testing if the object is an E instance.

If you supply one of equals and hashCode, you should generally also to supply the other. An example would be using identical and identityHashCode, which is equivalent to using the shorthand LinkedSet.identity).