Summary: Ctors | Methods | Inherited Methods | [Expand All]
public abstract class

# OptionalPendingResult

extends PendingResult<R extends Result>

java.lang.Object
↳ | com.google.android.gms.common.api.PendingResult<R extends com.google.android.gms.common.api.Result>
| ↳ | com.google.android.gms.common.api.OptionalPendingResult<R extends com.google.android.gms.common.api.Result>

## Class Overview

OptionalPendingResults are `PendingResult`s with additional support for non-blocking accessors. The result of an OptionalPendingResult may be available immediately. If the result is available `isDone()` will return true.

## Summary

Public Constructors
| OptionalPendingResult()

Public Methods
abstract R | get() Returns the `Result` immediately if it is available.
abstract boolean | isDone() Returns true if the result is available immediately, false otherwise.

[Expand] Inherited Methods
From class com.google.android.gms.common.api.PendingResult
abstract R | await() Blocks until the task is completed.
abstract R | await(long time, TimeUnit units) Blocks until the task is completed or has timed out waiting for the result.
abstract void | cancel() Requests that the PendingResult be canceled.
abstract boolean | isCanceled() Indicates whether the pending result has been canceled either due to calling `disconnect()` or calling `cancel()` directly on the pending result or an enclosing `Batch`.
abstract void | setResultCallback(ResultCallback<? super R> callback) Set the callback here if you want the result to be delivered via a callback when the result is ready.
abstract void | setResultCallback(ResultCallback<? super R> callback, long time, TimeUnit units) Set the callback here if you want the result to be delivered via a callback when the result is ready or has timed out waiting for the result.
<S extends Result> TransformedResult<S> | then(ResultTransform<? super R, ? extends S> transform) Transforms the result by making another API call.
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()

## Public Constructors

#### public OptionalPendingResult ()

## Public Methods

#### public abstract R get ()

Returns the `Result` immediately if it is available. If the result is not available, an exception will be thrown. This method should only be called after checking that `isDone()` returns true.

After the result has been retrieved using `get()`, `await()`, or has been delivered to the result callback, it is an error to attempt to retrieve the result again. It is the responsibility of the caller or callback receiver to release any resources associated with the returned result. Some result types may implement `Releasable`, in which case `release()` should be used to free the associated resources.

##### Throws

IllegalStateException | when the result is not `isDone()`.

#### public abstract boolean isDone ()

Returns true if the result is available immediately, false otherwise.