T
- The type of the elements of this list.F
- The type of the elements of the backing list.public class SetTransformationView<F,T>
extends java.util.AbstractSet<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 |
---|
SetTransformationView(java.util.Collection<F> backingCollection,
java.util.function.Function<? super F,? extends T> function) |
SetTransformationView(java.util.Collection<F> backingCollection,
InvertibleFunction<F,T> function) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T e) |
java.util.Collection<F> |
getBackingCollection() |
InvertibleFunction<F,T> |
getFunction() |
protected java.util.Collection<F> |
getModifiablebackingCollection() |
java.util.Iterator<T> |
iterator() |
int |
size() |
addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public SetTransformationView(java.util.Collection<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 SetTransformationView(java.util.Collection<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 boolean add(T e)
public final InvertibleFunction<F,T> getFunction()
public final java.util.Collection<F> getBackingCollection()
protected final java.util.Collection<F> getModifiablebackingCollection()
public final int size()