Exception handling in stream 2021-11-18 2022-06-01 Java 123public interface ExceptionFunction<T, R> { R apply(T t) throws Exception;} 1234567891011public class ExceptionUtil { public static <T, R> Function<T, R> wrap(ExceptionFunction<T, R> f) { return (T t) -> { try { return f.apply(t); } catch (Exception e) { throw new RuntimeException(e); } }; }}