public abstract class Future<T> extends Object
A future has the method get() which waits for the calculation to complete, and returns the result.
The client must create a subclass and implement the method populate() which will be run in the thread.
The reason for the creation of this class is the JVM-supplied Future object seemed too complex.
| Modifier and Type | Class and Description |
|---|---|
static class |
Future.FutureComputationTimedOutException |
static class |
Future.IterableFuture<I>
An iterable whose values are computed in the background.
|
| Constructor and Description |
|---|
Future() |
| Modifier and Type | Method and Description |
|---|---|
T |
get()
Returns the object, waiting for its computation to be completed if necessary.
|
T |
getOrTimeoutAfterSeconds(float seconds)
Same as
get() but times out after 'seconds' seconds. |
public T getOrTimeoutAfterSeconds(float seconds) throws Future.FutureComputationTimedOutException
get() but times out after 'seconds' seconds.public T get()