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. |
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
|
[Expand]
Inherited Methods |
From class
org.apache.commons.collections.collection.CompositeCollection
boolean
|
add(Object obj)
Adds an object to the collection, throwing UnsupportedOperationException
unless a CollectionMutator strategy is specified.
|
boolean
|
addAll(Collection coll)
Adds a collection of elements to this collection, throwing
UnsupportedOperationException unless a CollectionMutator strategy is specified.
|
void
|
addComposited(Collection c, Collection d)
Add two additional collections to this composite.
|
void
|
addComposited(Collection c)
Add an additional collection to this composite.
|
void
|
addComposited(Collection[] comps)
Add these Collections to the list of collections in this composite
|
void
|
clear()
Removes all of the elements from this collection .
|
boolean
|
contains(Object obj)
Checks whether this composite collection contains the object.
|
boolean
|
containsAll(Collection coll)
Checks whether this composite contains all the elements in the specified collection.
|
Collection
|
getCollections()
Gets the collections being decorated.
|
boolean
|
isEmpty()
Checks whether this composite collection is empty.
|
Iterator
|
iterator()
Gets an iterator over all the collections in this composite.
|
boolean
|
remove(Object obj)
Removes an object from the collection, throwing UnsupportedOperationException
unless a CollectionMutator strategy is specified.
|
boolean
|
removeAll(Collection coll)
Removes the elements in the specified collection from this composite collection.
|
void
|
removeComposited(Collection coll)
Removes a collection from the those being decorated in this composite.
|
boolean
|
retainAll(Collection coll)
Retains all the elements in the specified collection in this composite collection,
removing all others.
|
void
|
setMutator(CompositeCollection.CollectionMutator mutator)
Specify a CollectionMutator strategy instance to handle changes.
|
int
|
size()
Gets the size of this composite collection.
|
Object[]
|
toArray()
Returns an array containing all of the elements in this composite.
|
Object[]
|
toArray(Object[] array)
Returns an object array, populating the supplied array if possible.
|
Collection
|
toCollection()
Returns a new collection containing all of the elements
|
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
From interface
java.lang.Iterable
|
From interface
java.util.Collection
abstract
boolean
|
add(E arg0)
|
abstract
boolean
|
addAll(Collection<? extends E> arg0)
|
abstract
void
|
clear()
|
abstract
boolean
|
contains(Object arg0)
|
abstract
boolean
|
containsAll(Collection<?> arg0)
|
abstract
boolean
|
equals(Object arg0)
|
abstract
int
|
hashCode()
|
abstract
boolean
|
isEmpty()
|
abstract
Iterator<E>
|
iterator()
|
abstract
boolean
|
remove(Object arg0)
|
abstract
boolean
|
removeAll(Collection<?> arg0)
|
abstract
boolean
|
retainAll(Collection<?> arg0)
|
abstract
int
|
size()
|
abstract
<T>
T[]
|
toArray(T[] arg0)
|
abstract
Object[]
|
toArray()
|
|
From interface
java.util.Set
abstract
boolean
|
add(E arg0)
|
abstract
boolean
|
addAll(Collection<? extends E> arg0)
|
abstract
void
|
clear()
|
abstract
boolean
|
contains(Object arg0)
|
abstract
boolean
|
containsAll(Collection<?> arg0)
|
abstract
boolean
|
equals(Object arg0)
|
abstract
int
|
hashCode()
|
abstract
boolean
|
isEmpty()
|
abstract
Iterator<E>
|
iterator()
|
abstract
boolean
|
remove(Object arg0)
|
abstract
boolean
|
removeAll(Collection<?> arg0)
|
abstract
boolean
|
retainAll(Collection<?> arg0)
|
abstract
int
|
size()
|
abstract
<T>
T[]
|
toArray(T[] arg0)
|
abstract
Object[]
|
toArray()
|
|
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
public
synchronized
void
addComposited
(Collection[] comps)
Add an array of sets to this composite
Parameters
comps
| Collections to be appended to the composite
|
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
|
public
boolean
equals
(Object obj)
public
boolean
remove
(Object obj)
If a CollectionMutator
is defined for this CompositeSet then this
method will be called anyway.
Returns
- true if the object is removed, false otherwise
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
|