Interface UncheckedFuture<V>

  • Type Parameters:
    V - The result type returned by this Future's get() and get(long, TimeUnit) methods.
    All Superinterfaces:
    java.util.concurrent.Future<V>

    public interface UncheckedFuture<V>
    extends java.util.concurrent.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 
      Modifier and Type Method Description
      V get()
      Gets per Future.get() but rethrows checked exceptions as unchecked.
      V get​(long timeout, java.util.concurrent.TimeUnit unit)
      Gets per Future.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.
      • Methods inherited from interface java.util.concurrent.Future

        cancel, isCancelled, isDone
    • 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() and get(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() and get(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'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:

        Specified by:
        get in interface java.util.concurrent.Future<V>
      • get

        V get​(long timeout,
              java.util.concurrent.TimeUnit unit)
        Gets per Future.get(long, TimeUnit) but rethrows checked exceptions as unchecked.

        The default mapping from checked to unchecked is:

        Specified by:
        get in interface java.util.concurrent.Future<V>