Class Mapping

java.lang.Object
org.rspeer.commons.Mapping

public class Mapping extends Object
Mapping utilities
  • Constructor Details

    • Mapping

      public Mapping()
  • Method Details

    • 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)
    • orM1

      public static <T> int orM1(Supplier<T> supplier, ToIntFunction<T> function)
    • ifPresent

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