|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.actor.gt.data.CombinedCollection<E>
E
- The type of elements in the collection.public class CombinedCollection<E>
A collection that is the combination of one or more collections. This is a more efficient implementation that copying all the elements of those collections into a new collection and using that collection. No copying is necessary because the component collections are maintained locally and their elements are retrieved only when they are used.
ActorGraphFrame
Red (tfeng) |
Yellow (tfeng) |
Nested Class Summary | |
---|---|
private class |
CombinedCollection.Iterator
The iterator for iterating elements in this collection. |
Field Summary | |
---|---|
private java.util.List<java.util.Collection<? extends E>> |
_collectionList
The list containing all the component collections. |
private boolean |
_isLastListModifiable
Whether the last component collection in the list can be modified (i.e., it is not given by the user but is created for storing new elements. |
Constructor Summary | |
---|---|
CombinedCollection()
Construct a combined collection with no collection as its component. |
|
CombinedCollection(java.util.Collection<? extends E>... collections)
Construct a combined collection with one or more collections as its components. |
Method Summary | ||
---|---|---|
protected java.util.List<java.util.Collection<? extends E>> |
_getCollectionList()
Get the list containing all the component collections. |
|
boolean |
add(E element)
Add an element to the end of this collection. |
|
boolean |
addAll(java.util.Collection<? extends E> collection)
Add all elements of the provided collection to this collection. |
|
void |
clear()
Clear this collection by removing all its components. |
|
boolean |
contains(java.lang.Object element)
Test whether this collection contains the given element. |
|
boolean |
containsAll(java.util.Collection<?> collection)
Test whether this collection contains all the elements of the given collection. |
|
boolean |
isEmpty()
Test whether this collection is empty. |
|
java.util.Iterator<E> |
iterator()
Return an iterator to iterate all the elements in this collection. |
|
boolean |
remove(java.lang.Object element)
Throw a runtime exception because removal is not supported. |
|
boolean |
removeAll(java.util.Collection<?> collection)
Throw a runtime exception because removal is not supported. |
|
boolean |
retainAll(java.util.Collection<?> collection)
Throw a runtime exception because removal is not supported. |
|
int |
size()
Return size of this collection. |
|
java.lang.Object[] |
toArray()
Return an array that contains all the elements in this collection. |
|
|
toArray(T[] array)
Store all the elements in this collection into the given array if its size is enough for the storage, or create a new array of the same type as the given array for the storage and return it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
equals, hashCode |
Field Detail |
---|
private java.util.List<java.util.Collection<? extends E>> _collectionList
private boolean _isLastListModifiable
Constructor Detail |
---|
public CombinedCollection()
public CombinedCollection(java.util.Collection<? extends E>... collections)
collections
- The collections.Method Detail |
---|
public boolean add(E element)
add
in interface java.util.Collection<E>
element
- The new element.
public boolean addAll(java.util.Collection<? extends E> collection)
addAll
in interface java.util.Collection<E>
collection
- The collection to be added.
public void clear()
clear
in interface java.util.Collection<E>
public boolean contains(java.lang.Object element)
contains
in interface java.util.Collection<E>
element
- The element.
public boolean containsAll(java.util.Collection<?> collection)
containsAll
in interface java.util.Collection<E>
collection
- The collection.
public boolean isEmpty()
isEmpty
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>
public boolean remove(java.lang.Object element)
remove
in interface java.util.Collection<E>
element
- The element to be removed.
public boolean removeAll(java.util.Collection<?> collection)
removeAll
in interface java.util.Collection<E>
collection
- The collection whose elements are to be removed.
public boolean retainAll(java.util.Collection<?> collection)
retainAll
in interface java.util.Collection<E>
collection
- The collection whose elements are to be retained.
public int size()
size
in interface java.util.Collection<E>
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<E>
public <T> T[] toArray(T[] array)
toArray
in interface java.util.Collection<E>
T
- The element type of the array.array
- The array.
protected java.util.List<java.util.Collection<? extends E>> _getCollectionList()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |