sclass Pair is Comparable> { settable A a; settable B b; *() {} *(A *a, B *b) {} public int hashCode() { ret hashCodeFor(a) + 2*hashCodeFor(b); } public bool equals(O o) { if (o == this) true; if (!(o instanceof Pair)) false; Pair t = (Pair) o; ret eq(a, t.a) && eq(b, t.b); } toString { ret "<" + a + ", " + b + ">"; } public int compareTo(Pair p) { if (p == null) ret 1; int i = ((Comparable) a).compareTo(p.a); if (i != 0) ret i; ret ((Comparable) b).compareTo(p.b); } }