com.g2forge.alexandria.java.function.IThrowFunction1 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ax-java Show documentation
Show all versions of ax-java Show documentation
Standard Java library and the basis of the ${alexandria.name} project.
package com.g2forge.alexandria.java.function;
@FunctionalInterface
public interface IThrowFunction1 extends IFunction {
public static IThrowFunction1 create(IThrowFunction1 function) {
return function;
}
public static IThrowFunction1 identity() {
return v -> v;
}
public O apply(I input) throws T;
public default IFunction1 wrap(IFunction1 super Throwable, ? extends RuntimeException> wrapper) {
return i -> {
try {
return apply(i);
} catch (Throwable throwable) {
throw wrapper.apply(throwable);
}
};
}
}