public abstract class CompositeCollection<E> extends CompositeIterable<E> implements java.util.Collection<E>
contains(Object) to the individual sets. Iterates by pulling the iterators of the
individual sets. Just creating the composite set happens in O(1) by assigning the passed array of
sets. The contains-check performs in O(n) is n is the number of sets held by this composite set and
assuming that the individual sets can perform their contains-check in O(1). The composite set is
unmodifiable. All modifying operations throw an exception.| Constructor and Description |
|---|
CompositeCollection(java.util.Collection<? extends E>... collections) |
CompositeCollection(java.util.Collection<java.lang.Iterable<? extends E>> collections) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e) |
boolean |
addAll(java.util.Collection<? extends E> c) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
getIterablespublic CompositeCollection(java.util.Collection<? extends E>... collections)
public CompositeCollection(java.util.Collection<java.lang.Iterable<? extends E>> collections)
public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<E>public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<E>public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<E>public boolean addAll(java.util.Collection<? extends E> c)
addAll in interface java.util.Collection<E>public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<E>public void clear()
clear in interface java.util.Collection<E>public java.util.Iterator<E> iterator()
iterator in interface java.lang.Iterable<E>iterator in interface java.util.Collection<E>iterator in class CompositeIterable<E>public int size()
size in interface java.util.Collection<E>public boolean isEmpty()
isEmpty in interface java.util.Collection<E>public java.lang.Object[] toArray()
toArray in interface java.util.Collection<E>public <T> T[] toArray(T[] a)
toArray in interface java.util.Collection<E>public boolean containsAll(java.util.Collection<?> c)
containsAll in interface java.util.Collection<E>