001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.utils;
014
015import java.util.function.*;
016
017/**
018 * Allows you to perform a function against 3 objects.
019 *
020 * <p>
021 * Similar to {@link BiFunction} except for 3 parameters.
022 *
023 * <p class='bjava'>
024 *    Tuple3Function&lt;A,B,C,R&gt; <jv>x</jv> = (<jv>a</jv>,<jv>b</jv>,<jv>c</jv>) -&gt; <jsm>doSomething</jsm>(<jv>a</jv>,<jv>b</jv>,<jv>c</jv>);
025 *
026 *    R <jv>result</jv> = <jv>x</jv>.apply(<jv>xa</jv>,<jv>xb</jv>,<jv>xc</jv>);
027 * </p>
028 *
029 * <h5 class='section'>See Also:</h5><ul>
030 * </ul>
031 *
032 * @param <A> Object 1 type.
033 * @param <B> Object 2 type.
034 * @param <C> Object 3 type.
035 * @param <R> Result type.
036 */
037@FunctionalInterface
038public interface Tuple3Function<A,B,C,R> {
039
040   @SuppressWarnings("javadoc")
041   R apply(A a, B b, C c);
042
043   @SuppressWarnings("javadoc")
044   default <V> Tuple3Function<A,B,C,V> andThen(Function<? super R, ? extends V> after) {
045      return (A a, B b, C c) -> after.apply(apply(a, b, c));
046   }
047}