David Jencks | bae4484 | 2014-06-21 20:15:24 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) OSGi Alliance (2014). All Rights Reserved. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.osgi.util.function; |
| 18 | |
| 19 | import org.osgi.annotation.versioning.ConsumerType; |
| 20 | |
| 21 | /** |
| 22 | * A function that accepts a single argument and produces a result. |
| 23 | * |
| 24 | * <p> |
| 25 | * This is a functional interface and can be used as the assignment target for a |
| 26 | * lambda expression or method reference. |
| 27 | * |
| 28 | * @param <T> The type of the function input. |
| 29 | * @param <R> The type of the function output. |
| 30 | * |
| 31 | * @ThreadSafe |
| 32 | * @author $Id: 5d812f75c0b4f88f01083189babb3ef7476b5ced $ |
| 33 | */ |
| 34 | @ConsumerType |
| 35 | public interface Function<T, R> { |
| 36 | /** |
| 37 | * Applies this function to the specified argument. |
| 38 | * |
| 39 | * @param t The input to this function. |
| 40 | * @return The output of this function. |
| 41 | */ |
| 42 | R apply(T t); |
| 43 | } |