
ru.progrm_jarvis.javacommons.util.function.FloatBinaryOperator Maven / Gradle / Ivy
package ru.progrm_jarvis.javacommons.util.function;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import java.util.function.BinaryOperator;
import java.util.function.UnaryOperator;
/**
* Represents an operation on a single {@code float} operand that produces a {@code float} result.
* This is the primitive type specialization of {@link UnaryOperator} for {@code float}.
*
* @see UnaryOperator non-primitive generic equivalent
*/
@FunctionalInterface
public interface FloatBinaryOperator extends BinaryOperator<@NotNull Float> {
/**
* Applies this operator to the given operands.
*
* @param left the first operand
* @param right the second operand
* @return result of applying this operation to the operands
*/
float applyAsFloat(float left, float right);
@Override
@Contract("null, _ -> fail; _, null -> fail; _ -> _")
default @NotNull Float apply(final @NotNull Float left, final @NotNull Float right) {
// note: there is no need for explicit null-checkins as it will be done when unwrapping the values
return applyAsFloat(left, right);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy