All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.progrm_jarvis.javacommons.util.function.ThrowingBiFunction Maven / Gradle / Ivy

package ru.progrm_jarvis.javacommons.util.function;

import lombok.SneakyThrows;

import java.util.function.BiFunction;

/**
 * An extension of {@link BiFunction} allowing throwing calls in its body.
 *
 * @param  the type of the first argument to the function
 * @param  the type of the second argument to the function
 * @param  the type of the exception thrown by the function
 */
@FunctionalInterface
public interface ThrowingBiFunction extends BiFunction {

    /**
     * Applies this function to the given arguments.
     *
     * @param t the first function argument
     * @param u the second function argument
     * @return the function result
     * @throws X if an exception happens
     *
     */
    R invoke(T t, U u) throws X;

    @Override
    @SneakyThrows
    default R apply(final T t, final U u) {
        return invoke(t, u);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy