public class TransformedList<E> extends TransformedCollection<E> implements List<E>
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.
Modifier and Type | Class and Description |
---|---|
protected class |
TransformedList.TransformedListIterator
Inner class Iterator for the TransformedList
|
transformer
Modifier | Constructor and Description |
---|---|
protected |
TransformedList(List<E> list,
Transformer<? super E,? extends E> transformer)
Constructor that wraps (not copies).
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
E object) |
boolean |
addAll(int index,
Collection<? extends E> coll) |
boolean |
equals(Object object) |
E |
get(int index) |
protected List<E> |
getList()
Gets the decorated list.
|
int |
hashCode() |
int |
indexOf(Object object) |
int |
lastIndexOf(Object object) |
ListIterator<E> |
listIterator() |
ListIterator<E> |
listIterator(int i) |
E |
remove(int index) |
E |
set(int index,
E object) |
List<E> |
subList(int fromIndex,
int toIndex) |
static <E> TransformedList<E> |
transformedList(List<E> list,
Transformer<? super E,? extends E> transformer)
Factory method to create a transforming list that will transform
existing contents of the specified list.
|
static <E> TransformedList<E> |
transformingList(List<E> list,
Transformer<? super E,? extends E> transformer)
Factory method to create a transforming list.
|
add, addAll, transform, transform, transformedCollection, transformingCollection
clear, contains, containsAll, decorated, isEmpty, iterator, remove, removeAll, removeIf, retainAll, setCollection, size, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, replaceAll, retainAll, size, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
protected TransformedList(List<E> list, Transformer<? super E,? extends E> 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 nullNullPointerException
- if list or transformer is nullpublic static <E> TransformedList<E> transformingList(List<E> list, Transformer<? super E,? extends E> transformer)
If there are any elements already in the list being decorated, they
are NOT transformed.
Contrast this with transformedList(List, Transformer)
.
E
- the type of the elements in the listlist
- the list to decorate, must not be nulltransformer
- the transformer to use for conversion, must not be nullNullPointerException
- if list or transformer is nullpublic static <E> TransformedList<E> transformedList(List<E> list, Transformer<? super E,? extends E> transformer)
If there are any elements already in the list being decorated, they
will be transformed by this method.
Contrast this with transformingList(List, Transformer)
.
E
- the type of the elements in the listlist
- the list to decorate, must not be nulltransformer
- the transformer to use for conversion, must not be nullNullPointerException
- if list or transformer is nullpublic int hashCode()
public int lastIndexOf(Object object)
lastIndexOf
in interface List<E>
public boolean addAll(int index, Collection<? extends E> coll)
public ListIterator<E> listIterator()
listIterator
in interface List<E>
public ListIterator<E> listIterator(int i)
listIterator
in interface List<E>
Copyright © 2001–2019 The Apache Software Foundation. All rights reserved.