|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<E>
net.sf.molae.pipe.trafo.TransformedCollection<S,E>
public final class TransformedCollection<S,E>
Provides a different view to an existing collection by transforming each element.
| Constructor Summary | |
|---|---|
TransformedCollection(Collection<S> base,
TwoWayTransformer<S,E> transformer)
Constructs a TransformedCollection object. |
|
| Method Summary | ||
|---|---|---|
boolean |
add(E o)
Ensures that the base collection contains an element that transforms into the specified element. |
|
void |
clear()
Removes all of the elements from the base collection. |
|
boolean |
contains(Object o)
Returns true if the base collection contains an element
that would transform into the specified element. |
|
boolean |
isEmpty()
Returns true if the base collection contains no elements. |
|
Iterator<E> |
iterator()
|
|
static
|
newInstance(Collection<S> base,
TwoWayTransformer<S,E> transformer)
Constructs a TransformedCollection object. |
|
boolean |
remove(Object o)
Removes an element from the base list that would transform into the specified object, if such an element exists. |
|
int |
size()
Returns the number of elements in the base collection. |
|
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, containsAll, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public TransformedCollection(Collection<S> base,
TwoWayTransformer<S,E> transformer)
base - the underlying collectiontransformer - the transformer that maps each element to another one.
NullPointerException - if any of the specified objects is
null.| Method Detail |
|---|
public static <S,E> TransformedCollection<S,E> newInstance(Collection<S> base,
TwoWayTransformer<S,E> transformer)
base - the underlying collectiontransformer - the transformer that maps each element to another one.
NullPointerException - if any of the specified objects is
null.public int size()
size in interface Collection<E>size in class AbstractCollection<E>public boolean isEmpty()
true if the base collection contains no elements.
isEmpty in interface Collection<E>isEmpty in class AbstractCollection<E>true if the base collection contains no elements.public boolean contains(Object o)
true if the base collection contains an element
that would transform into the specified element.
contains in interface Collection<E>contains in class AbstractCollection<E>o - element whose presence in this collection is to be tested.
true if the base collection contains an element
that would transform into the specified element.public Iterator<E> iterator()
iterator in interface Iterable<E>iterator in interface Collection<E>iterator in class AbstractCollection<E>public boolean add(E o)
add in interface Collection<E>add in class AbstractCollection<E>UnsupportedOperationException - depending on the base class and
the transformer
ClassCastException - class of the specified element prevents
finding a source element for it.
IllegalArgumentException - some aspect of this element prevents
finding a source element for it.public boolean remove(Object o)
remove in interface Collection<E>remove in class AbstractCollection<E>true if the base collection changed as a result
of the callpublic void clear()
clear in interface Collection<E>clear in class AbstractCollection<E>UnsupportedOperationException - depending on the base collection
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||