I needed a TriFunction
Since Java 8 you can do such nice functional things, I love it. But, for some reason it has Functions and BiFunctions, but no TriFunctions! So, it was time to add the TriFunction interface. And yes, I’m very immature :-P import java.util.Objects; import java.util.function.Function; @FunctionalInterface public interface TriFunction<S, U, C, K> { /** * Applies this function to the given arguments * @param s the first argument * @param u the second arguments * @param c the third argument * @return K */ K apply(S s, U u, C c); /** * Returns a composed function that first applies this function to its input * and then applies the {@code after} function to the result. * * If evaluation of either function throws an exception, it is relayed to * the caller of the composed function. * @param <T> * @param after * @return */ default <T> TriFunction<S, U, C, T> andThen(Function<? super K, ? extends T> after) { Objects.requireNonNull(after); return (S s, U u, C c) -> after.apply(apply(s, u, c)); } } ...