@SuppressWarnings("unchecked")
  public static <TResult> Task<TResult> forResult(TResult value) {
    if (value == null) {
      return (Task<TResult>) TASK_NULL;
    }
    if (value instanceof Boolean) {
      return (Task<TResult>) ((Boolean) value ? TASK_TRUE : TASK_FALSE);
    }
    bolts.TaskCompletionSource<TResult> tcs = new bolts.TaskCompletionSource<>();
    tcs.setResult(value);
    return tcs.getTask();
  }
@ SuppressWarnings ( "unchecked" ) public static < TResult > Task < TResult > forResult ( TResult value ) { if ( value == null ) { return ( Task < TResult > ) TASK_NULL ; } if ( value instanceof Boolean ) { return ( Task < TResult > ) ( ( Boolean ) value ? TASK_TRUE : TASK_FALSE ) ; } bolts . TaskCompletionSource < TResult > tcs = new bolts . TaskCompletionSource < > ( ) ; tcs . setResult ( value ) ; return tcs . getTask ( ) ; }
Creates a completed task with the given value.