|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.collections.collection.CompositeCollection<E> org.apache.commons.collections.set.CompositeSet<E>
public class CompositeSet<E>
Decorates a set of other sets to provide a single unified view.
Changes made to this set will actually be made on the decorated set. Add and remove operations require the use of a pluggable strategy. If no strategy is provided then add and remove are unsupported.
Nested Class Summary | |
---|---|
static interface |
CompositeSet.SetMutator<E>
Define callbacks for mutation operations. |
Nested classes/interfaces inherited from class org.apache.commons.collections.collection.CompositeCollection |
---|
CompositeCollection.CollectionMutator<E> |
Field Summary |
---|
Fields inherited from class org.apache.commons.collections.collection.CompositeCollection |
---|
all, mutator |
Constructor Summary | |
---|---|
CompositeSet()
Create an empty CompositeSet |
|
CompositeSet(Set<E> set)
Create a CompositeSet with just set composited |
|
CompositeSet(Set<E>[] sets)
Create a composite set with sets as the initial set of composited Sets |
Method Summary | |
---|---|
void |
addComposited(Collection<? extends E> c)
Add a Set to this composite |
void |
addComposited(Collection<? extends E>[] comps)
Add an array of sets to this composite |
void |
addComposited(Collection<? extends E> c,
Collection<? extends E> d)
Add two sets to this composite |
boolean |
equals(Object obj)
|
int |
hashCode()
|
boolean |
remove(Object obj)
If a CollectionMutator is defined for this CompositeSet then this
method will be called anyway. |
void |
setMutator(CompositeCollection.CollectionMutator<E> mutator)
This can receive either a CompositeCollection.CollectionMutator
or a CompositeSet.SetMutator . |
Methods inherited from class org.apache.commons.collections.collection.CompositeCollection |
---|
add, addAll, clear, contains, containsAll, getCollections, isEmpty, iterator, removeAll, removeComposited, retainAll, size, toArray, toArray, toCollection |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, removeAll, retainAll, size, toArray, toArray |
Constructor Detail |
---|
public CompositeSet()
public CompositeSet(Set<E> set)
set
composited
set
- The initial set in the compositepublic CompositeSet(Set<E>[] sets)
Method Detail |
---|
public void addComposited(Collection<? extends E> c)
addComposited
in class CompositeCollection<E>
c
- Must implement Set
IllegalArgumentException
- if c does not implement java.util.Set
or if a SetMutator is set, but fails to resolve a collision
UnsupportedOperationException
- if there is no SetMutator set, or
a CollectionMutator is set instead of a SetMutatorCompositeCollection.CollectionMutator
,
CompositeSet.SetMutator
public void addComposited(Collection<? extends E> c, Collection<? extends E> d)
addComposited
in class CompositeCollection<E>
c
- the first collection to addd
- the second collection to add
IllegalArgumentException
- if c or d does not implement java.util.Setpublic void addComposited(Collection<? extends E>[] comps)
addComposited
in class CompositeCollection<E>
comps
-
IllegalArgumentException
- if any of the collections in comps do not implement Setpublic void setMutator(CompositeCollection.CollectionMutator<E> mutator)
CompositeCollection.CollectionMutator
or a CompositeSet.SetMutator
. If a
CompositeCollection.CollectionMutator
is used than conflicts when adding
composited sets will throw IllegalArgumentException
setMutator
in class CompositeCollection<E>
mutator
- the mutator to usepublic boolean remove(Object obj)
CollectionMutator
is defined for this CompositeSet then this
method will be called anyway.
remove
in interface Collection<E>
remove
in interface Set<E>
remove
in class CompositeCollection<E>
obj
- Object to be removed
public boolean equals(Object obj)
equals
in interface Collection<E>
equals
in interface Set<E>
equals
in class Object
Set.equals(java.lang.Object)
public int hashCode()
hashCode
in interface Collection<E>
hashCode
in interface Set<E>
hashCode
in class Object
Set.hashCode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |