Class CompositeSet
java.lang.Object
org.apache.commons.collections.collection.CompositeCollection
org.apache.commons.collections.set.CompositeSet
- All Implemented Interfaces:
Iterable
,Collection
,Set
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 operations require the use of a pluggable strategy. If no strategy is provided then add is unsupported.
- Since:
- Commons Collections 3.0
- Version:
- $Revision: 646777 $ $Date: 2008-04-10 14:33:15 +0200 (Thu, 10 Apr 2008) $
- Author:
- Brian McCallister
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Define callbacks for mutation operations.Nested classes/interfaces inherited from class org.apache.commons.collections.collection.CompositeCollection
CompositeCollection.CollectionMutator
-
Field Summary
Fields inherited from class org.apache.commons.collections.collection.CompositeCollection
all, mutator
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty CompositeSetCompositeSet
(Set set) Create a CompositeSet with justset
compositedCompositeSet
(Set[] sets) Create a composite set with sets as the initial set of composited Sets -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a Set to this compositevoid
addComposited
(Collection[] comps) Add an array of sets to this compositevoid
Add two sets to this compositeboolean
int
hashCode()
boolean
If aCollectionMutator
is defined for this CompositeSet then this method will be called anyway.void
This can receive either aCompositeCollection.CollectionMutator
or aCompositeSet.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.Collection
parallelStream, removeIf, stream, toArray
-
Constructor Details
-
CompositeSet
public CompositeSet()Create an empty CompositeSet -
CompositeSet
Create a CompositeSet with justset
composited- Parameters:
set
- The initial set in the composite
-
CompositeSet
Create a composite set with sets as the initial set of composited Sets
-
-
Method Details
-
addComposited
Add a Set to this composite- Overrides:
addComposited
in classCompositeCollection
- Parameters:
c
- Must implement Set- Throws:
IllegalArgumentException
- if c does not implement java.util.Set or if a SetMutator is set, but fails to resolve a collisionUnsupportedOperationException
- if there is no SetMutator set, or a CollectionMutator is set instead of a SetMutator- See Also:
-
addComposited
Add two sets to this composite- Overrides:
addComposited
in classCompositeCollection
- Parameters:
c
- the first collection to addd
- the second collection to add- Throws:
IllegalArgumentException
- if c or d does not implement java.util.Set
-
addComposited
Add an array of sets to this composite- Overrides:
addComposited
in classCompositeCollection
- Parameters:
comps
-- Throws:
IllegalArgumentException
- if any of the collections in comps do not implement Set
-
setMutator
This can receive either aCompositeCollection.CollectionMutator
or aCompositeSet.SetMutator
. If aCompositeCollection.CollectionMutator
is used than conflicts when adding composited sets will throw IllegalArgumentException- Overrides:
setMutator
in classCompositeCollection
- Parameters:
mutator
- the mutator to use
-
remove
If aCollectionMutator
is defined for this CompositeSet then this method will be called anyway.- Specified by:
remove
in interfaceCollection
- Specified by:
remove
in interfaceSet
- Overrides:
remove
in classCompositeCollection
- Parameters:
obj
- Object to be removed- Returns:
- true if the object is removed, false otherwise
-
equals
-
hashCode
public int hashCode()
-