|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections.collection.AbstractCollectionDecorator<E>
org.apache.commons.collections.collection.AbstractSerializableCollectionDecorator
org.apache.commons.collections.collection.TransformedCollection<I,O>
org.apache.commons.collections.list.TransformedList<I,O>
public class TransformedList<I,O>
Decorates another List
to transform objects that are added.
The add and set methods are affected by this class. Thus objects must be removed or searched for using their transformed form. For example, if the transformation converts Strings to Integers, you must use the Integer form to remove objects.
This class is Serializable from Commons Collections 3.1.
Note: This class cannot support generics without breaking the Collection contract.
Nested Class Summary | |
---|---|
protected class |
TransformedList.TransformedListIterator
Inner class Iterator for the TransformedList |
Field Summary |
---|
Fields inherited from class org.apache.commons.collections.collection.TransformedCollection |
---|
transformer |
Fields inherited from class org.apache.commons.collections.collection.AbstractCollectionDecorator |
---|
collection |
Constructor Summary | |
---|---|
protected |
TransformedList(List<I> list,
Transformer<? super I,? extends O> transformer)
Constructor that wraps (not copies). |
Method Summary | ||
---|---|---|
void |
add(int index,
Object object)
|
|
boolean |
addAll(int index,
Collection coll)
|
|
void |
addTyped(int index,
I object)
Type-safe version of add(int, Object) (but breaks List interface). |
|
static
|
decorate(List<I> list,
Transformer<? super I,? extends O> transformer)
Factory method to create a transforming list. |
|
O |
get(int index)
|
|
protected List<O> |
getList()
Gets the decorated list. |
|
int |
indexOf(Object object)
|
|
int |
lastIndexOf(Object object)
|
|
ListIterator<O> |
listIterator()
|
|
ListIterator<O> |
listIterator(int i)
|
|
Object |
remove(int index)
|
|
O |
set(int index,
Object object)
|
|
O |
setTyped(int index,
I object)
Type-safe version of set(int, Object) (but breaks List interface). |
|
List<O> |
subList(int fromIndex,
int toIndex)
|
Methods inherited from class org.apache.commons.collections.collection.TransformedCollection |
---|
add, addAll, addAllTyped, addTyped, decorate, transform, transform |
Methods inherited from class org.apache.commons.collections.collection.AbstractCollectionDecorator |
---|
clear, contains, containsAll, equals, getCollection, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Constructor Detail |
---|
protected TransformedList(List<I> list, Transformer<? super I,? extends O> transformer)
If there are any elements already in the list being decorated, they are NOT transformed.
list
- the list to decorate, must not be nulltransformer
- the transformer to use for conversion, must not be null
IllegalArgumentException
- if list or transformer is nullMethod Detail |
---|
public static <I,O> List<O> decorate(List<I> list, Transformer<? super I,? extends O> transformer)
If there are any elements already in the list being decorated, they are NOT transformed.
list
- the list to decorate, must not be nulltransformer
- the transformer to use for conversion, must not be null
IllegalArgumentException
- if list or transformer is nullprotected List<O> getList()
public O get(int index)
get
in interface List
public int indexOf(Object object)
indexOf
in interface List
public int lastIndexOf(Object object)
lastIndexOf
in interface List
public Object remove(int index)
remove
in interface List
public void add(int index, Object object)
add
in interface List
public void addTyped(int index, I object)
add(int, Object)
(but breaks List interface).
public boolean addAll(int index, Collection coll)
addAll
in interface List
public ListIterator<O> listIterator()
listIterator
in interface List
public ListIterator<O> listIterator(int i)
listIterator
in interface List
public O set(int index, Object object)
set
in interface List
public O setTyped(int index, I object)
set(int, Object)
(but breaks List interface).
public List<O> subList(int fromIndex, int toIndex)
subList
in interface List
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |