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

org.libj.util.function.TriConsumer Maven / Gradle / Ivy

Go to download

Supplementary utilities for classes that belong to java.util, or are considered essential as to justify existence in java.util.

There is a newer version: 0.9.1
Show newest version
/* Copyright (c) 2019 LibJ
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * You should have received a copy of The MIT License (MIT) along with this
 * program. If not, see .
 */

package org.libj.util.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 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 public 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. * * @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(final 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