001package Torello.Java.Function;
002
003/**
004 * Function-Pointer
005 * <SPAN CLASS=TJF>Input:</SPAN> {@code A, B, C}
006 * <SPAN CLASS=TJF>Output:</SPAN> {@code void}.
007 * 
008 * <BR /><BR />
009 * <EMBED CLASS="external-html" DATA-FILE-ID=BIGCONS>
010 * <EMBED CLASS="globalDefs" DATA-Name='Tri Consumer' DATA-Number=three>
011 * @param <A> The type of the first input-parameter.
012 * @param <B> The type of the second input-parameter.
013 * @param <C> The type of the last input-parameter.
014 */
015@FunctionalInterface
016public interface TriConsumer<A, B, C>
017{
018    /**
019     * Performs {@code 'this'} operation on the given arguments.
020     * @param a the first input argument
021     * @param b the second input argument
022     * @param c the third input argument
023     */
024    public void accept(A a, B b, C c);
025
026    /**
027     * <EMBED CLASS="external-html" DATA-FILE-ID="CONTHENMETH">
028     * @param after <EMBED CLASS="external-html" DATA-FILE-ID="CONTHENAFT">
029     * @return <EMBED CLASS="external-html" DATA-FILE-ID="CONTHENRET">
030     * @throws NullPointerException if parameter {@code 'other'} is null.
031     */
032    default TriConsumer<A, B, C> andThen(TriConsumer<? super A, ? super B, ? super C> after)
033    {
034        if (after == null)
035            throw new NullPointerException("null has been passed to parameter 'after'");
036
037        return (A a, B b, C c) ->
038        {
039            this.accept(a, b, c);
040            after.accept(a, b, c);
041        };
042    }
043 
044}