Package org.rspeer.commons
Class Mapping
- java.lang.Object
-
- org.rspeer.commons.Mapping
-
public class Mapping extends Object
Mapping utilities
-
-
Constructor Summary
Constructors Constructor Description Mapping()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> void
ifPresent(Supplier<T> supplier, Consumer<T> consumer)
static <T,R>
RorDefault(Supplier<T> supplier, Function<T,R> function, R fallback)
static <T> int
orDefault(Supplier<T> supplier, ToIntFunction<T> function, int fallback)
static <T> boolean
orElse(Supplier<T> supplier, Predicate<T> function)
static <T> boolean
orElse(Supplier<T> supplier, Predicate<T> function, boolean fallback)
static <T> int
orM1(Supplier<T> supplier, ToIntFunction<T> function)
static <T,R>
RorNull(Supplier<T> supplier, Function<T,R> function)
-
-
-
Method Detail
-
orDefault
public static <T,R> R orDefault(Supplier<T> supplier, Function<T,R> function, R fallback)
- Type Parameters:
T
- argument typeR
- return type- Parameters:
supplier
- The supplierfunction
- The function to applyfallback
- The value to return if the supplied arg is null- Returns:
- Applies a single argument function to the supplied argument and returns the result if the arg is not null, else returns the fallback value
-
orElse
public static <T> boolean orElse(Supplier<T> supplier, Predicate<T> function, boolean fallback)
-
orDefault
public static <T> int orDefault(Supplier<T> supplier, ToIntFunction<T> function, int fallback)
-
orM1
public static <T> int orM1(Supplier<T> supplier, ToIntFunction<T> function)
-
-