T - The type of the elements of this list.F - The type of the elements of the backing list.public class ListTransformationView<F,T>
extends java.util.AbstractList<T>
Unlike the Stream.map(Function) function, which can provide similar
functionality in certain circumstances, this class provides a view which is
reusable and backed by the original collection, such that it will reflect
changes.
If the constructor is supplied with an InvertibleFunction, it will be
possible to add elements to this collection.
| Constructor and Description |
|---|
ListTransformationView(java.util.List<F> backingCollection,
java.util.function.Function<? super F,? extends T> function) |
ListTransformationView(java.util.List<F> backingCollection,
InvertibleFunction<F,T> function) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
T element) |
T |
get(int index) |
java.util.List<F> |
getBackingCollection() |
InvertibleFunction<F,T> |
getFunction() |
protected java.util.List<F> |
getModifiablebackingCollection() |
T |
remove(int index) |
T |
set(int index,
T element) |
int |
size() |
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic ListTransformationView(java.util.List<F> backingCollection, java.util.function.Function<? super F,? extends T> function)
backingCollection - The backing collection this class presents a view over.function - The function which transforms elements into the form in which they
are represented in by this view.public ListTransformationView(java.util.List<F> backingCollection, InvertibleFunction<F,T> function)
backingCollection - The backing collection this class presents a view over.function - The function which transforms elements into the form in which they
are represented in by this view.public void add(int index,
T element)
public T remove(int index)
public final T get(int index)
public final InvertibleFunction<F,T> getFunction()
public final java.util.List<F> getBackingCollection()
protected final java.util.List<F> getModifiablebackingCollection()