| Modifier and Type | Method and Description |
|---|---|
static <K,V> Function<K,V> |
fromMap(Map<? super K,? extends V> map,
V defaultValue)
Create a
Function that is backed by the given map. |
static <S,T> Function<T,S> |
invert(Function<? super S,? extends T> function,
Iterable<? extends S> arguments)
|
public static <S,T> Function<T,S> invert(Function<? super S,? extends T> function, Iterable<? extends S> arguments)
Function that is the inverse of the given
Function, defined for the given arguments. For a
given function f : S -> T and a set of arguments
S0, the returned function will be a
function that maps each t from
T0 = f(S0) to the s from
S0 for which f(s) = t.
If the given function is not injective (that is, when multiple
arguments are mapped to the same value), then the resulting
function will return the last argument that was mapped to the
respective ambiguous value, based on the order of the given
arguments sequence.public static <K,V> Function<K,V> fromMap(Map<? super K,? extends V> map, V defaultValue)
Function that is backed by the given map.
Modifications of the given map will be visible through
the returned function.K - The key typeV - The value typemap - The backing mapdefaultValue - The default value to return when a
function argument is not contained in the map.Copyright © 2020. All rights reserved.