// A: object type
// B: hash type (e.g. Long)
sclass UniquifyUsingHasher {
settable IF1 hasher;
*(IF1 *hasher) {}
new MultiMap byHash;
gettable new L list;
bool add(A a) {
B hash = hasher.get(a);
if (byHash.contains(hash, a)) false;
byHash.put(hash, a);
true;
}
bool addAll(Iterable l) {
bool change;
fOr (A a : l)
change |= add(a);
ret change;
}
L get() { ret list; }
}