Skip to content

Instantly share code, notes, and snippets.

View diogoarm's full-sized avatar

Diogo Monteiro diogoarm

View GitHub Profile
@diogoarm
diogoarm / ThrowingFunction.java
Created June 28, 2020 23:04
Functional interface to use with streams, it changes checked exception to unchecked.
package ...
import java.util.function.Function;
@FunctionalInterface
public interface ThrowingFunction<T, R, E extends Throwable> {
R apply(T t) throws E;
static <T, R, E extends Throwable> Function<T, R> unchecked(ThrowingFunction<T, R, E> f) {