public final class Transformers extends Object
Function.| Modifier and Type | Class and Description |
|---|---|
static class |
Transformers.LazyTransformSet<V1,V2>
A
Set that transform values from an original set of type
V1 into values of type V2 on-the-fly using a
transformation Function. |
| Constructor and Description |
|---|
Transformers() |
| Modifier and Type | Method and Description |
|---|---|
static <F,V> V[] |
transformArray(F[] original,
Function<? super F,? extends V> function,
Class<V> vClass)
Return an array whose content is equal to the content of
original
after it has been transformed by function. |
static <K,K2,V> Map<K2,V> |
transformMap(Map<K,V> original,
Function<? super K,? extends K2> function)
Return a Map whose keys are equal to the those in
original after
it has been transformed by function. |
static <K1,V1,K2,V2> |
transformMapEntries(Map<K1,V1> original,
Function<K1,K2> keyFunction,
Function<V1,V2> valueFunction)
Return a new
Map where the key and value of each entry is
transformed by the keyFunction and valueFunction
respectively. |
static <K,K2,V,V2> |
transformMapSet(Map<K,Set<V>> original,
Function<? super K,? extends K2> keys,
Function<? super V,? extends V2> values)
Transform the keys in
original with the keys function
and each of the values with the values function and return the
result. |
static <K,V,V2> Map<K,V2> |
transformMapValues(Map<K,V> original,
Function<V,V2> function)
Transform each of the values in the
original with the
function. |
static <F,V> Set<V> |
transformSet(Set<F> original,
Function<? super F,? extends V> function)
|
static <V1,V2> Set<V2> |
transformSetLazily(Set<V1> original,
Function<V1,V2> function)
Return a
Set that lazily populates a new set with items from the
original after applying the transformation function. |
static <K,K2,V,V2> |
transformTreeMapSet(Map<K,Set<V>> original,
Function<? super K,? extends K2> keys,
Function<? super V,? extends V2> values,
Comparator<K2> sorter)
Transform the keys in
original with the keys function
and each of the values with the values function and return the
map result that is sorted according to the sorter. |
public static <F,V> V[] transformArray(F[] original,
Function<? super F,? extends V> function,
Class<V> vClass)
original
after it has been transformed by function.original - function - vClass - - the class object for the type to which the items in
original will be transformedpublic static <K,K2,V> Map<K2,V> transformMap(Map<K,V> original, Function<? super K,? extends K2> function)
original after
it has been transformed by function.
WARNING: There is the potential for data loss in the
event that function returns duplicate transformed results for
items in original.
original - function - public static <K,K2,V,V2> Map<K2,Set<V2>> transformMapSet(Map<K,Set<V>> original, Function<? super K,? extends K2> keys, Function<? super V,? extends V2> values)
original with the keys function
and each of the values with the values function and return the
result.
WARNING: There is the potential for data loss in the
event that function returns duplicate transformed results for
items in original.
original - keys - values - public static <K,V,V2> Map<K,V2> transformMapValues(Map<K,V> original, Function<V,V2> function)
original with the
function.original - function - public static <K1,V1,K2,V2> Map<K2,V2> transformMapEntries(Map<K1,V1> original, Function<K1,K2> keyFunction, Function<V1,V2> valueFunction)
Map where the key and value of each entry is
transformed by the keyFunction and valueFunction
respectively.original - the original map in which the transformations are
performedkeyFunction - the function to transform each entry keyvalueFunction - the function to transform each entry valueMappublic static <F,V> Set<V> transformSet(Set<F> original, Function<? super F,? extends V> function)
Set with the items in original after applying
function.
WARNING: There is the potential for data loss in the
event that function returns duplicate transformed results for
items in original.
original - the Set to transformfunction - the transformation Functionpublic static <V1,V2> Set<V2> transformSetLazily(Set<V1> original, Function<V1,V2> function)
Set that lazily populates a new set with items from the
original after applying the transformation function.original - the Set to transformfunction - the transformation Functionpublic static <K,K2,V,V2> Map<K2,Set<V2>> transformTreeMapSet(Map<K,Set<V>> original, Function<? super K,? extends K2> keys, Function<? super V,? extends V2> values, Comparator<K2> sorter)
original with the keys function
and each of the values with the values function and return the
map result that is sorted according to the sorter.
WARNING: There is the potential for data loss in the
event that function returns duplicate transformed results for
items in original.
original - keys - values - sorter -