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

net.openhft.chronicle.testframework.function.TriConsumer Maven / Gradle / Ivy

There is a newer version: 2.27ea0
Show newest version
package net.openhft.chronicle.testframework.function;

import java.util.Objects;
import java.util.function.Consumer;

/**
 * Represents an operation that accepts three input arguments and returns no
 * result. This is the three-arity specialization of {@link Consumer}.
 * Unlike most other functional interfaces, {@code TriConsumer} is expected
 * to operate via side-effects.
 * 

* This can be used anywhere you need to apply an operation to three input parameters * and don't need to return a result, for example, in handling events with three attributes. * *

This is a functional interface * whose functional method is {@link #accept(Object, Object, Object)}. * * @param the type of the first argument to the operation * @param the type of the second argument to the operation * @param the type of the third argument to the operation * @see Consumer */ @FunctionalInterface interface TriConsumer { /** * Performs this operation on the given arguments. * * @param t the first input argument * @param u the second input argument * @param v the third input argument */ void accept(T t, U u, V v); /** * Returns a composed {@code TriConsumer} that performs, in sequence, this * operation followed by the {@code after} operation. If performing either * operation throws an exception, it is relayed to the caller of the * composed operation. If performing this operation throws an exception, * the {@code after} operation will not be performed. * *

This can be useful in scenarios where you have several operations that * must be performed on the same set of input parameters, possibly by different parts * of your code. * * @param after the operation to perform after this operation * @return a composed {@code TriConsumer} that performs in sequence this * operation followed by the {@code after} operation * @throws NullPointerException if {@code after} is null */ default TriConsumer andThen(TriConsumer after) { Objects.requireNonNull(after); return (t, u, v) -> { accept(t, u, v); after.accept(t, u, v); }; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy