All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javascalautils.ThrowableFunction1 Maven / Gradle / Ivy

The newest version!
/**
 * Copyright 2015 Peter Nerg
 *
 * 

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * *

http://www.apache.org/licenses/LICENSE-2.0 * *

Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package javascalautils; /** * A function that takes a single argument of type R and returns a value of type T. *
* The difference with this interface and {@link java.util.function.Function} is that it allows for * raising checked exceptions.
* Primary use case is to create concise lambda expressions such as the {@link * Try#map(ThrowableFunction1)} and {@link javascalautils.concurrent.Future#map(ThrowableFunction1)} * where the function could throw an exception. * * @author Peter Nerg * @since 1.10 * @param The type this function will consume * @param The type this function will return */ @FunctionalInterface public interface ThrowableFunction1 { /** * Applies this function returning a result. * * @param t The value of type T provided to the function * @return The function result * @throws Throwable Any error that may occur when applying the function * @since 1.10 */ R apply(T t) throws Throwable; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy