001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.utils;
018
019import java.util.function.*;
020
021/**
022 * Functional interface for consumers of 3-part arguments.
023 *
024 * @param <A> Argument 1.
025 * @param <B> Argument 2.
026 * @param <C> Argument 3.
027 */
028@FunctionalInterface
029public interface Consumer3<A,B,C> {
030
031   /**
032    * Performs this operation on the given arguments.
033    *
034    * @param a Argument 1.
035    * @param b Argument 2.
036    * @param c Argument 3.
037    */
038   void apply(A a, B b, C c);
039
040   /**
041    * Returns a composed {@link Consumer} that performs, in sequence, this operation followed by the <c>after</c> operation.
042    *
043    * @param <V> The return type.
044    * @param after The operation to perform after this operation.
045    * @return A composed {@link Consumer} that performs in sequence this operation followed by the after operation.
046    */
047   default <V> Consumer3<A,B,C> andThen(Consumer3<? super A,? super B,? super C> after) {  // NOSONAR - false positive on generics
048      return (A a, B b, C c) -> {
049         apply(a, b, c);
050         after.apply(a, b, c);
051      };
052   }
053}