Package org.n52.janmayen.function
Class Suppliers
java.lang.Object
org.n52.janmayen.function.Suppliers
Utility functions for
Supplier.-
Method Summary
Modifier and TypeMethodDescriptionstatic <U,V> Function <U, V> asFunction(Supplier<V> supplier) Creates a function ignoring it's parameter and just returning the supplier's value.static <T> Supplier<T> constant(T t) Returns a constant supplier.static <U,V> Supplier <V> Maps the output of an supplier using a function.
-
Method Details
-
constant
Returns a constant supplier.- Type Parameters:
T- the type of the supplied value- Parameters:
t- the constant- Returns:
- the constant supplier
-
mapping
public static <U,V> Supplier<V> mapping(Function<? super U, ? extends V> mapper, Supplier<U> supplier) Maps the output of an supplier using a function.- Type Parameters:
U- The original suppliers return typeV- The new suppliers return type- Parameters:
mapper- the mappersupplier- the original supplier- Returns:
- the new supplier
-
asFunction
Creates a function ignoring it's parameter and just returning the supplier's value.- Type Parameters:
U- the parameter typeV- the supplier's return type- Parameters:
supplier- the supplier- Returns:
- the function
-