public class CombinedSet<T> extends AbstractSet<T> implements Serializable
Constructor and Description |
---|
CombinedSet(Collection<? extends Set<T>> sets) |
CombinedSet(Set<T>... sets) |
Modifier and Type | Method and Description |
---|---|
void |
append(Set<T> set)
Adds the provided set to this
CombinedSet . |
void |
clear()
Clears the elements from all backing sets.
|
boolean |
contains(Object o)
Returns
true if at least one of the sets in this CombinedSet 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 all the backing sets, returning
true if at least one set contained that element. |
int |
size()
Returns the number of unique items across all sets.
|
equals, hashCode, removeAll
add, addAll, containsAll, retainAll, toArray, toArray, toString
public CombinedSet(Collection<? extends Set<T>> sets)
public void append(Set<T> set)
CombinedSet
. 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 CombinedSet
.public boolean contains(Object o)
true
if at least one of the sets in this CombinedSet
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 at least one set contained that element.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.