@Test public void testDisjointSet() { DisjointSet<String> t1 = new DisjointSet<String>(true); DisjointSet<String> t2 = new DisjointSet<String>(t1); DisjointSet<String> t3 = new DisjointSet<String>(t2); assertNotNull(t1.getTrash()); assertSame(t1.getTrash(), t2.getTrash()); assertSame(t2.getTrash(), t3.getTrash()); assertTrue(t1.add("alpha")); assertTrue(t2.add("bêta")); assertTrue(t3.add("gamma")); assertTrue(t2.add("delta")); assertTrue(t1.add("epsilon")); assertTrue(t2.add("alpha")); assertTrue(t2.remove("bêta")); assertEquals(Collections.singleton("epsilon"), t1); assertEquals(new HashSet<String>(Arrays.asList(new String[] {"alpha","delta"})), t2); assertEquals(Collections.singleton("gamma"), t3); assertEquals(Collections.singleton("bêta"), t1.getTrash()); }
public DisjointSet() { this(false); }
DisjointSet extends AbstractSet<E> implements Serializable { public DisjointSet() { this(false); } }
DisjointSet extends AbstractSet<E> implements Serializable { public DisjointSet() { this(false); } DisjointSet();  DisjointSet(final boolean hasTrash);  DisjointSet(final DisjointSet<E> disjointSet); private  DisjointSet(final Map<E, DisjointSet<E>> map); }
DisjointSet extends AbstractSet<E> implements Serializable { public DisjointSet() { this(false); } DisjointSet();  DisjointSet(final boolean hasTrash);  DisjointSet(final DisjointSet<E> disjointSet); private  DisjointSet(final Map<E, DisjointSet<E>> map); Set<E> getTrash(); int size(); @Override boolean contains(final Object element); @Override boolean add(final E element); @Override boolean remove(final Object element); @Override boolean containsAll(final Collection<?> c); @Override boolean addAll(final Collection<? extends E> c); @Override boolean removeAll(final Collection<?> c); @Override boolean retainAll(final Collection<?> c); @Override void clear(); Iterator<E> iterator(); @Override Object[] toArray(); @Override T[] toArray(final T[] a); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object set); }
DisjointSet extends AbstractSet<E> implements Serializable { public DisjointSet() { this(false); } DisjointSet();  DisjointSet(final boolean hasTrash);  DisjointSet(final DisjointSet<E> disjointSet); private  DisjointSet(final Map<E, DisjointSet<E>> map); Set<E> getTrash(); int size(); @Override boolean contains(final Object element); @Override boolean add(final E element); @Override boolean remove(final Object element); @Override boolean containsAll(final Collection<?> c); @Override boolean addAll(final Collection<? extends E> c); @Override boolean removeAll(final Collection<?> c); @Override boolean retainAll(final Collection<?> c); @Override void clear(); Iterator<E> iterator(); @Override Object[] toArray(); @Override T[] toArray(final T[] a); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object set);  }