Package cz.masci.springfx.mvci.util
Class FunctionUtils
java.lang.Object
cz.masci.springfx.mvci.util.FunctionUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,V> V applyNotNull(T source, Function<T, V> transform) Accepts not null source and applies the transform function on it.static <T,V> V applyNotNullElse(T source, Function<T, V> transform, V value) Accepts not null source and applies the transform function on it.static <T,V> V applyNotNullElseGet(T source, Function<T, V> transform, Supplier<V> value) Accepts not null source and applies the transform function on it.
-
Constructor Details
-
FunctionUtils
public FunctionUtils()
-
-
Method Details
-
applyNotNull
Accepts not null source and applies the transform function on it. If the source is null returns null.
- Type Parameters:
T- Type of source objectV- Type of transformed object- Parameters:
source- Source objecttransform- Transformation function- Returns:
- Transformed value or null
-
applyNotNullElse
Accepts not null source and applies the transform function on it. If the source is null returns value.
- Type Parameters:
T- Type of source objectV- Type of transformed object- Parameters:
source- Source objecttransform- Transformation functionvalue- Default value if source is null- Returns:
- Transformed value or default value
-
applyNotNullElseGet
Accepts not null source and applies the transform function on it. If the source is null returns supplied value.
- Type Parameters:
T- Type of source objectV- Type of transformed object- Parameters:
source- Source objecttransform- Transformation functionvalue- Supplier for default value if source is null- Returns:
- Transformed value or default value
-