public class TransSet<S,T> extends DelegateSet<T>
Set
interface that transforms the elements
of the supplied source Set
based on sourceToTarget
and
targetToSource
lambda functions.Set
Modifier and Type | Field and Description |
---|---|
protected Function<S,T> |
sourceToTarget |
protected Function<T,S> |
targetToSource |
target
Constructor and Description |
---|
TransSet(Set<S> source,
Function<S,T> sourceToTarget,
Function<T,S> targetToSource)
Creates a new
TransSet with the specified source Set, 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 |
removeIf(Predicate<? super T> filter) |
boolean |
retainAll(Collection<?> c) |
Object[] |
toArray() |
<E> E[] |
toArray(E[] a) |
clear, equals, forEach, hashCode, isEmpty, parallelStream, size, spliterator, stream, superForEach, superParallelStream, superRemoveIf, superSpliterator, superStream, toString
public TransSet(Set<S> source, Function<S,T> sourceToTarget, Function<T,S> targetToSource)
TransSet
with the specified source Set, 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 Set 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 interface Set<T>
contains
in class DelegateSet<T>
public Object[] toArray()
toArray
in interface Collection<T>
toArray
in interface Set<T>
toArray
in class DelegateSet<T>
public <E> E[] toArray(E[] a)
toArray
in interface Collection<T>
toArray
in interface Set<T>
toArray
in class DelegateSet<T>
public boolean add(T e)
add
in interface Collection<T>
add
in interface Set<T>
add
in class DelegateSet<T>
public boolean remove(Object o)
remove
in interface Collection<T>
remove
in interface Set<T>
remove
in class DelegateSet<T>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<T>
containsAll
in interface Set<T>
containsAll
in class DelegateSet<T>
public boolean addAll(Collection<? extends T> c)
addAll
in interface Collection<T>
addAll
in interface Set<T>
addAll
in class DelegateSet<T>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<T>
removeAll
in interface Set<T>
removeAll
in class DelegateSet<T>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<T>
retainAll
in interface Set<T>
retainAll
in class DelegateSet<T>
public boolean removeIf(Predicate<? super T> filter)
removeIf
in interface Collection<T>
removeIf
in class DelegateSet<T>
Copyright © 2020 LibJ. All rights reserved.