public class DisjointSets<T> extends AbstractSet<T> implements Serializable
| Constructor and Description |
|---|
DisjointSets(Collection<? extends Set<T>> sets) |
DisjointSets(Set<T>... sets) |
| Modifier and Type | Method and Description |
|---|---|
void |
append(Set<T> set)
Adds the provided set to this
DisjointSets. |
void |
clear()
Clears the elements from all backing sets.
|
boolean |
contains(Object o)
Returns
true if at least one of the sets in this DisjointSets has the provided element. |
boolean |
isEmpty()
Returns
true if all the sets are empty. |
Iterator<T> |
iterator()
Returns an iterator over all the unique items across all sets.
|
boolean |
remove(Object o)
Removes the provided element from the backing sets, returning
true if the element was in one set. |
int |
size()
Returns the number of unique items across all sets.
|
equals, hashCode, removeAlladd, addAll, containsAll, retainAll, toArray, toArray, toStringpublic DisjointSets(Collection<? extends Set<T>> sets)
public void append(Set<T> set)
DisjointSets. Note that this does
not perform an element-wise addition of the contents of set, but rather keeps a reference to set so that any changes to
set will be reflected in this DisjointSets.public boolean contains(Object o)
true if at least one of the sets in this DisjointSets has the provided element.contains in interface Collection<T>contains in interface Set<T>contains in class AbstractCollection<T>public void clear()
clear in interface Collection<T>clear in interface Set<T>clear in class AbstractCollection<T>public Iterator<T> iterator()
public boolean isEmpty()
true if all the sets are empty.isEmpty in interface Collection<T>isEmpty in interface Set<T>isEmpty in class AbstractCollection<T>public boolean remove(Object o)
true if the element was in one set.remove in interface Collection<T>remove in interface Set<T>remove in class AbstractCollection<T>public int size()
size in interface Collection<T>size in interface Set<T>size in class AbstractCollection<T>Copyright © 2012. All Rights Reserved.