类 UncheckedFunctions


  • public class UncheckedFunctions
    extends java.lang.Object
    Wrap checked interface to unchecked interface.

    If exception occurred, unchecked exceptions will be thrown directly, IOException will be wrapped in UncheckedIOException, other checked exceptions will be wrapped in UndeclaredLambdaException

    • 方法详细资料

      • call

        public static <T> T call​(UncheckedFunctions.ESupplier<T> supplier)
        Call a block of code, return result
        参数:
        supplier - the code to run
      • runnable

        public static java.lang.Runnable runnable​(UncheckedFunctions.ERunnable runnable)
        Wrap to Runnable interface
        返回:
        wrapped runnable
      • supplier

        public static <T> java.util.function.Supplier<T> supplier​(UncheckedFunctions.ESupplier<T> supplier)
        Wrap to Supplier interface
        返回:
        the Supplier
      • consumer

        public static <T> java.util.function.Consumer<T> consumer​(UncheckedFunctions.EConsumer<T> consumer)
        Wrap to Consumer interface
        返回:
        the Consumer
      • predicate

        public static <T> java.util.function.Predicate<T> predicate​(UncheckedFunctions.EPredicate<T> predicate)
        Wrap to Predicate interface
        类型参数:
        T - type to test
        返回:
        Predicate
      • function

        public static <T,​R> java.util.function.Function<T,​R> function​(UncheckedFunctions.EFunction<T,​R> function)
        Wrap to Function interface
        类型参数:
        T - function param type
        R - function return type
        返回:
        the Function
      • biConsumer

        public static <T,​U> java.util.function.BiConsumer<T,​U> biConsumer​(UncheckedFunctions.EBiConsumer<T,​U> consumer)
        Wrap to BiConsumer interface
        返回:
        the BiConsumer
      • biFunction

        public static <T,​U,​R> java.util.function.BiFunction<T,​U,​R> biFunction​(UncheckedFunctions.EBiFunction<T,​U,​R> function)
        Wrap to BiFunction interface
        类型参数:
        T - first function param type
        U - second function param type
        R - function return type
        返回:
        the BiFunction