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 5 objects.
019 *
020 * <p>
021 * Similar to {@link BiFunction} except for 5 parameters.
022 *
023 * <p class='bjava'>
024 *    Tuple5Function&lt;A,B,C,D,E,R&gt; <jv>x</jv> = (<jv>a</jv>,<jv>b</jv>,<jv>c</jv>,<jv>d</jv>,<jv>e</jv>) -&gt; <jsm>doSomething</jsm>(<jv>a</jv>,<jv>b</jv>,<jv>c</jv>,<jv>d</jv>,<jv>e</jv>);
025 *
026 *    R <jv>result</jv> = <jv>x</jv>.apply(<jv>xa</jv>,<jv>xb</jv>,<jv>xc</jv>,<jv>xd</jv>,<jv>xe</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 <D> Object 4 type.
036 * @param <E> Object 5 type.
037 * @param <R> Result type.
038 */
039@FunctionalInterface
040public interface Tuple5Function<A,B,C,D,E,R> {
041
042   @SuppressWarnings("javadoc")
043   R apply(A a, B b, C c, D d, E e);
044
045   @SuppressWarnings("javadoc")
046   default <V> Tuple5Function<A,B,C,D,E,V> andThen(Function<? super R, ? extends V> after) {
047      return (A a, B b, C c, D d, E e) -> after.apply(apply(a, b, c, d, e));
048   }
049}