static class Pair { A a; B b; *() {} *(A *a, B *b) {} public int hashCode() { ret main.hashCode((O) a) + 2*main.hashCode((O) 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); } }