Created
March 4, 2015 12:04
-
-
Save fge/5a5fbf647d1624c3d1e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.github.fge.lambdas.function; | |
| import com.github.fge.lambdas.ThrownByLambdaException; | |
| import java.util.function.Function; | |
| @FunctionalInterface | |
| public interface ThrowingFunction<T, R> | |
| extends Function<T, R> | |
| { | |
| R doApply(T t) | |
| throws Throwable; | |
| default R apply(T t) | |
| { | |
| try { | |
| return doApply(t); | |
| } catch (Error | RuntimeException e) { | |
| throw e; | |
| } catch (Throwable throwable) { | |
| throw new ThrownByLambdaException(throwable); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment