public class

CompositeSet

extends CompositeCollection
implements Set<E>
java.lang.Object
   ↳ org.apache.commons.collections.collection.CompositeCollection
     ↳ org.apache.commons.collections.set.CompositeSet

Class Overview

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.

Summary

Nested Classes
interface CompositeSet.SetMutator Define callbacks for mutation operations. 
[Expand]
Inherited Fields
From class org.apache.commons.collections.collection.CompositeCollection
Public Constructors
CompositeSet()
Create an empty CompositeSet
CompositeSet(Set set)
Create a CompositeSet with just set composited
CompositeSet(Set[] sets)
Create a composite set with sets as the initial set of composited Sets
Public Methods
synchronized void addComposited(Collection c)
Add a Set to this composite
synchronized void addComposited(Collection[] comps)
Add an array of sets to this composite
synchronized void addComposited(Collection c, Collection 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 mutator)
This can receive either a CompositeCollection.CollectionMutator or a CompositeSet.SetMutator.
[Expand]
Inherited Methods
From class org.apache.commons.collections.collection.CompositeCollection
From class java.lang.Object
From interface java.lang.Iterable
From interface java.util.Collection
From interface java.util.Set

Public Constructors

public CompositeSet ()

Create an empty CompositeSet

public CompositeSet (Set set)

Create a CompositeSet with just set composited

Parameters
set The initial set in the composite

public CompositeSet (Set[] sets)

Create a composite set with sets as the initial set of composited Sets

Public Methods

public synchronized void addComposited (Collection c)

Add a Set to this composite

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 collision
UnsupportedOperationException if there is no SetMutator set, or a CollectionMutator is set instead of a SetMutator

public synchronized void addComposited (Collection[] comps)

Add an array of sets to this composite

Parameters
comps Collections to be appended to the composite
Throws
IllegalArgumentException if any of the collections in comps do not implement Set

public synchronized void addComposited (Collection c, Collection d)

Add two sets to this composite

Parameters
c the first collection to add
d the second collection to add
Throws
IllegalArgumentException if c or d does not implement java.util.Set

public boolean equals (Object obj)

See Also

public int hashCode ()

See Also

public boolean remove (Object obj)

If a CollectionMutator is defined for this CompositeSet then this method will be called anyway.

Parameters
obj Object to be removed
Returns
  • true if the object is removed, false otherwise

public void setMutator (CompositeCollection.CollectionMutator mutator)

This can receive either a CompositeCollection.CollectionMutator or a CompositeSet.SetMutator. If a CompositeCollection.CollectionMutator is used than conflicts when adding composited sets will throw IllegalArgumentException

Parameters
mutator the mutator to use