@Test public void testConstruct() { DisjointSets<Integer> sets = new DisjointSets<Integer>(newRange(0, 10)); assertFalse(sets.areTogether(0, 1)); assertTrue(sets.areTogether(2, 2)); }
public boolean areTogether(E e1, E e2) { return map.get(e1).findRepresentative() == map.get(e2).findRepresentative(); }
DisjointSets implements Iterable<Set<E>> { public boolean areTogether(E e1, E e2) { return map.get(e1).findRepresentative() == map.get(e2).findRepresentative(); } }
DisjointSets implements Iterable<Set<E>> { public boolean areTogether(E e1, E e2) { return map.get(e1).findRepresentative() == map.get(e2).findRepresentative(); } DisjointSets(Collection<? extends E> c); }
DisjointSets implements Iterable<Set<E>> { public boolean areTogether(E e1, E e2) { return map.get(e1).findRepresentative() == map.get(e2).findRepresentative(); } DisjointSets(Collection<? extends E> c); boolean areTogether(E e1, E e2); void union(E e1, E e2); @Override Iterator<Set<E>> iterator(); static DisjointSets<E> singletonsOf(Class<E> elementType); }
DisjointSets implements Iterable<Set<E>> { public boolean areTogether(E e1, E e2) { return map.get(e1).findRepresentative() == map.get(e2).findRepresentative(); } DisjointSets(Collection<? extends E> c); boolean areTogether(E e1, E e2); void union(E e1, E e2); @Override Iterator<Set<E>> iterator(); static DisjointSets<E> singletonsOf(Class<E> elementType);  }