org.apache.commons.lang3.concurrent

## 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

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and 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 java.util.concurrent.Future

      `cancel, isCancelled, isDone`

- - ### Method Detail

    - #### 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>`

Copyright © 2001–2023 The Apache Software Foundation. All rights reserved.