| Modifier and Type | Method and Description |
|---|---|
static <D,R> Collection<R> |
apply(Mapping<? super D,R> mapping,
Collection<? extends D> coll)
Applies a mapping to a collection, resulting in a collection containing the result of applying the specified
mapping to each element in the collection.
|
static <D,R> Iterable<R> |
apply(Mapping<? super D,R> mapping,
Iterable<? extends D> it)
Applies a mapping to an iterable.
|
static <D,R> Iterator<R> |
apply(Mapping<? super D,R> mapping,
Iterator<? extends D> baseIt)
Applies a mapping to an iterator.
|
static <D,R> List<R> |
apply(Mapping<? super D,R> mapping,
List<? extends D> list)
Applies a mapping to a list, resulting in a list containing the result of applying the specified mapping to each
element in the list.
|
static <D,I,R> Mapping<D,R> |
compose(Mapping<D,? extends I> first,
Mapping<? super I,R> second)
Retrieves the composition of two mappings, i.e., that mapping that results from applying the
Mapping.get(Object) method consecutively. |
static <D,R> Mapping<D,R> |
fromMap(Map<D,R> map) |
static <T> Mapping<T,T> |
identity()
Retrieves the identity mapping, which maps each domain value to itself.
|
static <D> D |
idGet(Mapping<D,D> mapping,
D key) |
static <D,R> R |
nullGet(Mapping<? super D,? extends R> mapping,
D key) |
static <D,R> Mapping<D,R> |
nullMapping()
Retrieves the
null mapping, which maps each domain value to null. |
static <D,R> R |
safeGet(Mapping<? super D,R> mapping,
D key,
R fallback)
Safely retrieves a value from a mapping.
|
static <D> Mapping<D,String> |
toStringMapping()
Returns a mapping that maps objects to their
String representation, as obtained by String.valueOf(Object). |
static <S,T extends S> |
upcast()
Returns a mapping that maps objects to a supertype representation.
|
public static <D,R> Mapping<D,R> nullMapping()
null mapping, which maps each domain value to null.D - domain class.R - range class.null mapping.public static <T> Mapping<T,T> identity()
T - domain/range class.public static <D> Mapping<D,String> toStringMapping()
String representation, as obtained by String.valueOf(Object).toString()" mappingpublic static <S,T extends S> Mapping<T,S> upcast()
public static <D,I,R> Mapping<D,R> compose(Mapping<D,? extends I> first, Mapping<? super I,R> second)
Mapping.get(Object) method consecutively.D - domain class of the first (and resulting) mapping.I - intermediate object class, range class of the first and domain class of the second mapping.R - range class of the second (and resulting) mapping.first - first mapping.second - second mapping.public static <D,R> Collection<R> apply(Mapping<? super D,R> mapping, Collection<? extends D> coll)
Note that more specific properties of the specified collection won't be preserved: If the given collection is e.g. a set, and the provided mapping is not bijective, then the resulting collections may contain some values multiple times.
D - domain class.R - range class.mapping - the mapping to apply.coll - the collection.public static <D,R> Iterator<R> apply(Mapping<? super D,R> mapping, Iterator<? extends D> baseIt)
apply(Mapping, Iterable). The resulting iterator
supports each operation which the underlying supports.D - domain class.R - range class.mapping - the mapping to apply.baseIt - the underlying iterator.public static <D,R> List<R> apply(Mapping<? super D,R> mapping, List<? extends D> list)
mapping - the mapping to apply.list - the list.public static <D,R> Iterable<R> apply(Mapping<? super D,R> mapping, Iterable<? extends D> it)
D - domain class.R - range clas.mapping - the mapping to apply.it - the underlying iterable.public static <D> D idGet(Mapping<D,D> mapping, D key)
public static <D,R> R safeGet(Mapping<? super D,R> mapping, D key, R fallback)
null or returns a null
value, the given fallback value is returned.mapping - the mapping.key - the key.fallback - the fallback value to return if either the mapping or the originally returned value are
null.public static <D,R> R nullGet(Mapping<? super D,? extends R> mapping, D key)
Copyright © 2019. All rights reserved.