Uses of Interface java.util.concurrent.Future (Java SE 12 & JDK 12 )

## Uses of Interface
java.util.concurrent.Future

- Packages that use Future
  Package | Description
  --- | ---
  java.nio.channels | Defines channels, which represent connections to entities that are capable of performing I/O operations, such as files and sockets; defines selectors, for multiplexed, non-blocking I/O operations.
  java.util.concurrent | Utility classes commonly useful in concurrent programming.
  javax.swing | Provides a set of "lightweight" (all-Java language) components that, to the maximum degree possible, work the same on all platforms.

- - ### Uses of Future in java.nio.channels

    Methods in java.nio.channels that return Future
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract Future<AsynchronousSocketChannel>` | AsynchronousServerSocketChannel.`accept()` | Accepts a connection.
    `abstract Future<Void>` | AsynchronousSocketChannel.`connect​(SocketAddress remote)` | Connects this channel.
    `Future<FileLock>` | AsynchronousFileChannel.`lock()` | Acquires an exclusive lock on this channel's file.
    `abstract Future<FileLock>` | AsynchronousFileChannel.`lock​(long position, long size, boolean shared)` | Acquires a lock on the given region of this channel's file.
    `Future<Integer>` | AsynchronousByteChannel.`read​(ByteBuffer dst)` | Reads a sequence of bytes from this channel into the given buffer.
    `abstract Future<Integer>` | AsynchronousFileChannel.`read​(ByteBuffer dst, long position)` | Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.
    `abstract Future<Integer>` | AsynchronousSocketChannel.`read​(ByteBuffer dst)` |
    `Future<Integer>` | AsynchronousByteChannel.`write​(ByteBuffer src)` | Writes a sequence of bytes to this channel from the given buffer.
    `abstract Future<Integer>` | AsynchronousFileChannel.`write​(ByteBuffer src, long position)` | Writes a sequence of bytes to this channel from the given buffer, starting at the given file position.
    `abstract Future<Integer>` | AsynchronousSocketChannel.`write​(ByteBuffer src)` |

  - ### Uses of Future in java.util.concurrent

    Subinterfaces of Future in java.util.concurrent
    Modifier and Type | Interface | Description
    --- | --- | ---
    `interface` | `RunnableFuture<V>` | A `Future` that is `Runnable`.
    `interface` | `RunnableScheduledFuture<V>` | A `ScheduledFuture` that is `Runnable`.
    `interface` | `ScheduledFuture<V>` | A delayed result-bearing action that can be cancelled.

    Classes in java.util.concurrent that implement Future
    Modifier and Type | Class | Description
    --- | --- | ---
    `class` | `CompletableFuture<T>` | A `Future` that may be explicitly completed (setting its value and status), and may be used as a `CompletionStage`, supporting dependent functions and actions that trigger upon its completion.
    `class` | `CountedCompleter<T>` | A `ForkJoinTask` with a completion action performed when triggered and there are no remaining pending actions.
    `class` | `ForkJoinTask<V>` | Abstract base class for tasks that run within a `ForkJoinPool`.
    `class` | `FutureTask<V>` | A cancellable asynchronous computation.
    `class` | `RecursiveAction` | A recursive resultless `ForkJoinTask`.
    `class` | `RecursiveTask<V>` | A recursive result-bearing `ForkJoinTask`.

    Methods in java.util.concurrent that return Future
    Modifier and Type | Method | Description
    --- | --- | ---
    `Future<V>` | CompletionService.`poll()` | Retrieves and removes the Future representing the next completed task, or `null` if none are present.
    `Future<V>` | CompletionService.`poll​(long timeout, TimeUnit unit)` | Retrieves and removes the Future representing the next completed task, waiting if necessary up to the specified wait time if none are yet present.
    `Future<?>` | AbstractExecutorService.`submit​(Runnable task)` |
    `<T> Future<T>` | AbstractExecutorService.`submit​(Runnable task, T result)` |
    `<T> Future<T>` | AbstractExecutorService.`submit​(Callable<T> task)` |
    `Future<V>` | CompletionService.`submit​(Runnable task, V result)` | Submits a Runnable task for execution and returns a Future representing that task.
    `Future<V>` | CompletionService.`submit​(Callable<V> task)` | Submits a value-returning task for execution and returns a Future representing the pending results of the task.
    `Future<V>` | ExecutorCompletionService.`submit​(Runnable task, V result)` |
    `Future<V>` | ExecutorCompletionService.`submit​(Callable<V> task)` |
    `Future<?>` | ExecutorService.`submit​(Runnable task)` | Submits a Runnable task for execution and returns a Future representing that task.
    `<T> Future<T>` | ExecutorService.`submit​(Runnable task, T result)` | Submits a Runnable task for execution and returns a Future representing that task.
    `<T> Future<T>` | ExecutorService.`submit​(Callable<T> task)` | Submits a value-returning task for execution and returns a Future representing the pending results of the task.
    `Future<?>` | ScheduledThreadPoolExecutor.`submit​(Runnable task)` |
    `<T> Future<T>` | ScheduledThreadPoolExecutor.`submit​(Runnable task, T result)` |
    `<T> Future<T>` | ScheduledThreadPoolExecutor.`submit​(Callable<T> task)` |
    `Future<V>` | CompletionService.`take()` | Retrieves and removes the Future representing the next completed task, waiting if none are yet present.

    Methods in java.util.concurrent that return types with arguments of type Future
    Modifier and Type | Method | Description
    --- | --- | ---
    `<T> List<Future<T>>` | ExecutorService.`invokeAll​(Collection<? extends Callable<T>> tasks)` | Executes the given tasks, returning a list of Futures holding their status and results when all complete.
    `<T> List<Future<T>>` | ExecutorService.`invokeAll​(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)` | Executes the given tasks, returning a list of Futures holding their status and results when all complete or the timeout expires, whichever happens first.
    `<T> List<Future<T>>` | ForkJoinPool.`invokeAll​(Collection<? extends Callable<T>> tasks)` |

    Constructor parameters in java.util.concurrent with type arguments of type Future
    Constructor | Description
    --- | ---
    `ExecutorCompletionService​(Executor executor, BlockingQueue<Future<V>> completionQueue)` | Creates an ExecutorCompletionService using the supplied executor for base task execution and the supplied queue as its completion queue.

  - ### Uses of Future in javax.swing

    Classes in javax.swing that implement Future
    Modifier and Type | Class | Description
    --- | --- | ---
    `class` | `SwingWorker<T,​V>` | An abstract class to perform lengthy GUI-interaction tasks in a background thread.