Class Mapping


  • public class Mapping
    extends Object
    Mapping utilities
    • Constructor Detail

      • Mapping

        public Mapping()
    • Method Detail

      • orDefault

        public static <T,​R> R orDefault​(Supplier<T> supplier,
                                              Function<T,​R> function,
                                              R fallback)
        Type Parameters:
        T - argument type
        R - return type
        Parameters:
        supplier - The supplier
        function - The function to apply
        fallback - 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
      • orNull

        public static <T,​R> R orNull​(Supplier<T> supplier,
                                           Function<T,​R> function)
      • orElse

        public static <T> boolean orElse​(Supplier<T> supplier,
                                         Predicate<T> function,
                                         boolean fallback)
      • orElse

        public static <T> boolean orElse​(Supplier<T> supplier,
                                         Predicate<T> function)
      • orDefault

        public static <T> int orDefault​(Supplier<T> supplier,
                                        ToIntFunction<T> function,
                                        int fallback)
      • ifPresent

        public static <T> void ifPresent​(Supplier<T> supplier,
                                         Consumer<T> consumer)