S
- Type of source Collection.T
- Type of target Collection.public class TransCollection<S,T> extends DelegateCollection<T>
sourceToTarget
and
targetToSource
lambda functions.Collection
Modifier and Type | Field and Description |
---|---|
protected Function<S,T> |
sourceToTarget |
protected Function<T,S> |
targetToSource |
target
Constructor and Description |
---|
TransCollection(Collection<S> source,
Function<S,T> sourceToTarget,
Function<T,S> targetToSource)
Creates a new
TransCollection with the specified source Collection,
and functions defining the translation of objects types S -> T and
T -> S . |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T e) |
boolean |
addAll(Collection<? extends T> c) |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
Iterator<T> |
iterator() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
Object[] |
toArray() |
<E> E[] |
toArray(E[] a) |
clear, equals, forEach, hashCode, isEmpty, parallelStream, removeIf, size, spliterator, stream, superForEach, superParallelStream, superRemoveIf, superSpliterator, superStream, toString
public TransCollection(Collection<S> source, Function<S,T> sourceToTarget, Function<T,S> targetToSource)
TransCollection
with the specified source Collection,
and functions defining the translation of objects types S -> T
and
T -> S
.
If sourceToTarget
is null, all methods that require a translation
of S -> T
will throw a UnsupportedOperationException
.
If targetToSource
is null, all methods that require a translation
of T -> S
will throw a UnsupportedOperationException
.
source
- The source Collection of type <S>
.sourceToTarget
- The Function
defining the translation from
S -> T
.targetToSource
- The Function
defining the translation from
T -> S
.NullPointerException
- If source
is null.public boolean contains(Object o)
contains
in interface Collection<T>
contains
in class DelegateCollection<T>
public Iterator<T> iterator()
iterator
in interface Iterable<T>
iterator
in interface Collection<T>
iterator
in class DelegateCollection<T>
public Object[] toArray()
toArray
in interface Collection<T>
toArray
in class DelegateCollection<T>
public <E> E[] toArray(E[] a)
toArray
in interface Collection<T>
toArray
in class DelegateCollection<T>
public boolean add(T e)
add
in interface Collection<T>
add
in class DelegateCollection<T>
public boolean remove(Object o)
remove
in interface Collection<T>
remove
in class DelegateCollection<T>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<T>
containsAll
in class DelegateCollection<T>
public boolean addAll(Collection<? extends T> c)
addAll
in interface Collection<T>
addAll
in class DelegateCollection<T>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<T>
removeAll
in class DelegateCollection<T>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<T>
retainAll
in class DelegateCollection<T>
Copyright © 2020 LibJ. All rights reserved.