### Question:
DisjointSet { protected R find(R e) { R parent = matches.get(e); if (parent == null) { return null; } if (!parent.equals(e)) { R tmp = find(parent); if (!parent.equals(tmp)) { parent = tmp; matches.put(e, parent); } } return parent; } DisjointSet();  DisjointSet(Set<R> elements);  DisjointSet(DisjointSet<R> elements);  DisjointSet(DisjointSet<R> elements, R e1, R e2); int size(); DisjointSet<R> merge(DisjointSet<R> other); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testFind() { Integer root1 = ds.find(0); Integer root2 = ds.find(1); assertNotEquals(root1, root2); for (int i = 0; i < 10; i++) { assertEquals((i % 2) == 0 ? root1 : root2, ds.find(i)); } }