Interface UncheckedFuture<V>
-
- Type Parameters:
V
- The result type returned by this Future'sget()
andget(long, TimeUnit)
methods.
- All Superinterfaces:
java.util.concurrent.Future<V>
public interface UncheckedFuture<V> extends java.util.concurrent.Future<V>
AnFuture
that throws unchecked instead checked exceptions.- Since:
- 3.13.0
- See Also:
Future
,Exception
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description V
get()
Gets perFuture.get()
but rethrows checked exceptions as unchecked.V
get(long timeout, java.util.concurrent.TimeUnit unit)
Gets perFuture.get(long, TimeUnit)
but rethrows checked exceptions as unchecked.static <T> java.util.stream.Stream<UncheckedFuture<T>>
map(java.util.Collection<java.util.concurrent.Future<T>> futures)
Maps the given instances as unchecked.static <T> java.util.Collection<UncheckedFuture<T>>
on(java.util.Collection<java.util.concurrent.Future<T>> futures)
Maps the given instances as unchecked.static <T> UncheckedFuture<T>
on(java.util.concurrent.Future<T> future)
Creates a new instance on the given Future.
-
-
-
Method Detail
-
map
static <T> java.util.stream.Stream<UncheckedFuture<T>> map(java.util.Collection<java.util.concurrent.Future<T>> futures)
Maps the given instances as unchecked.- Type Parameters:
T
- The result type returned by the Futures'get()
andget(long, TimeUnit)
methods.- Parameters:
futures
- The Futures to uncheck.- Returns:
- a new stream.
-
on
static <T> java.util.Collection<UncheckedFuture<T>> on(java.util.Collection<java.util.concurrent.Future<T>> futures)
Maps the given instances as unchecked.- Type Parameters:
T
- The result type returned by the Futures'get()
andget(long, TimeUnit)
methods.- Parameters:
futures
- The Futures to uncheck.- Returns:
- a new collection.
-
on
static <T> UncheckedFuture<T> on(java.util.concurrent.Future<T> future)
Creates a new instance on the given Future.- Type Parameters:
T
- The result type returned by this Future'sget()
andget(long, TimeUnit)
methods.- Parameters:
future
- The Future to uncheck.- Returns:
- a new instance.
-
get
V get()
Gets perFuture.get()
but rethrows checked exceptions as unchecked.The default mapping from checked to unchecked is:
InterruptedException
→UncheckedInterruptedException
ExecutionException
→UncheckedExecutionException
- Specified by:
get
in interfacejava.util.concurrent.Future<V>
-
get
V get(long timeout, java.util.concurrent.TimeUnit unit)
Gets perFuture.get(long, TimeUnit)
but rethrows checked exceptions as unchecked.The default mapping from checked to unchecked is:
InterruptedException
→UncheckedInterruptedException
ExecutionException
→UncheckedExecutionException
TimeoutException
→UncheckedTimeoutException
- Specified by:
get
in interfacejava.util.concurrent.Future<V>
-
-