org.modeshape.common.util

## Class ImmediateFuture<V>

- java.lang.Object
- - org.modeshape.common.util.ImmediateFuture<V>

- Type Parameters:
    `V` - the type of result
  All Implemented Interfaces:
    Future<V>

      @Immutable
      public final class ImmediateFuture<V>
      extends Object
      implements Future<V>

  A `Future` implementation that is immediately done.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ImmediateFuture(V value)` Create a new `Future` instance that is completed immediately and returns the supplied result.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `cancel(boolean mayInterruptIfRunning)`
    `static <T> ImmediateFuture<T>` | `create(T value)` Factory method to more easily create an immediate future
    `V` | `get()`
    `V` | `get(long timeout, TimeUnit unit)`
    `boolean` | `isCancelled()`
    `boolean` | `isDone()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ImmediateFuture

          public ImmediateFuture(V value)

      Create a new `Future` instance that is completed immediately and returns the supplied result.
      Parameters:
        `value` - the value that the future should return

  - ### Method Detail

    - #### create

          public static <T> ImmediateFuture<T> create(T value)

      Factory method to more easily create an immediate future
      Type Parameters:
        `T` - the value type
      Parameters:
        `value` - the value that the future should return
      Returns:
        the new future; never null

    - #### cancel

          public boolean cancel(boolean mayInterruptIfRunning)

      Specified by:
        `cancel` in interface `Future<V>`

    - #### get

          public V get()

      Specified by:
        `get` in interface `Future<V>`

    - #### get

          public V get(long timeout,
              TimeUnit unit)

      Specified by:
        `get` in interface `Future<V>`

    - #### isCancelled

          public boolean isCancelled()

      Specified by:
        `isCancelled` in interface `Future<V>`

    - #### isDone

          public boolean isDone()

      Specified by:
        `isDone` in interface `Future<V>`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.