net.florianschoppmann.java.futures.CheckedSupplier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-futures Show documentation
Show all versions of java-futures Show documentation
Bridge gaps and help overcome inconveniences with CompletableFuture.
This module includes, among other features, methods to collect the results of multiple futures into a list,
provides equivalent alternatives to CompletableFuture’s monadic methods (thenApply, thenCompose, etc.) that can
deal with checked exceptions, and methods for asynchronous “try-with-resources” constructs.
The newest version!
package net.florianschoppmann.java.futures;
import javax.annotation.Nullable;
/**
* Represents a supplier of results. The supplier may throw a checked exception.
*
* There is no requirement that a new or distinct result be returned each time the supplier is invoked.
*
*
This method is similar to {@link java.util.function.Supplier}, except that the functional method may throw a
* checked exception.
*
* @param the type of results supplied by this supplier
*
* @see java.util.function.Supplier
*/
@FunctionalInterface
public interface CheckedSupplier {
/**
* Gets a result.
*
* @return a result
* @throws Exception if unable to supply a value
*/
@Nullable
T checkedGet() throws Exception;
}