UncheckedFuture (Apache Commons Lang 3.20.0 API)
Description: declaration: package: org.apache.commons.lang3.concurrent, interface: UncheckedFuture

# Interface UncheckedFuture<V>

Type Parameters:
  `V` - The result type returned by this Future's `get()` and `get(long, TimeUnit)` methods.

All Superinterfaces:
  `Future<V>`

public interface UncheckedFuture<V> extends Future<V>
An `Future` that throws unchecked instead checked exceptions.

Since:
  3.13.0
See Also:
  - `Future`
  - `Exception`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `V`
  `get()`
  Gets per `Future.get()` but rethrows checked exceptions as unchecked.
  `V`
  `get(long timeout, TimeUnit unit)`
  Gets per `Future.get(long, TimeUnit)` but rethrows checked exceptions as unchecked.
  `static <T> Stream<UncheckedFuture<T>>`
  `map(Collection<Future<T>> futures)`
  Maps the given instances as unchecked.
  `static <T> Collection<UncheckedFuture<T>>`
  `on(Collection<Future<T>> futures)`
  Maps the given instances as unchecked.
  `static <T> UncheckedFuture<T>`
  `on(Future<T> future)`
  Creates a new instance on the given Future.

  ### Methods inherited from interface Future

  `cancel, isCancelled, isDone`

- ## Method Details

  - ### map

    static <T> Stream<UncheckedFuture<T>> map(Collection<Future<T>> futures)
    Maps the given instances as unchecked.
    Type Parameters:
      `T` - The result type returned by the Futures' `get()` and `get(long, TimeUnit)` methods.
    Parameters:
      `futures` - The Futures to uncheck.
    Returns:
      a new stream.

  - ### on

    static <T> Collection<UncheckedFuture<T>> on(Collection<Future<T>> futures)
    Maps the given instances as unchecked.
    Type Parameters:
      `T` - The result type returned by the Futures' `get()` and `get(long, TimeUnit)` methods.
    Parameters:
      `futures` - The Futures to uncheck.
    Returns:
      a new collection.

  - ### on

    static <T> UncheckedFuture<T> on(Future<T> future)
    Creates a new instance on the given Future.
    Type Parameters:
      `T` - The result type returned by this Future's `get()` and `get(long, TimeUnit)` methods.
    Parameters:
      `future` - The Future to uncheck.
    Returns:
      a new instance.

  - ### get

    V get()
    Gets per `Future.get()` but rethrows checked exceptions as unchecked.

    The default mapping from checked to unchecked is:

    - `InterruptedException` → `UncheckedInterruptedException`
    - `ExecutionException` → `UncheckedExecutionException`
    Specified by:
      `get` in interface `Future<V>`

  - ### get

    V get(long timeout, TimeUnit unit)
    Gets per `Future.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 interface `Future<V>`