class Result {

  @SuppressWarnings({"ConstantConditions", "unchecked"})
  @NonNull
  public Result<T> attemptRecover(
      @NonNull final Function<? super Throwable, ? extends Result<? extends T>>
          attemptRecoverFunction) {
    if (value != null) {
      return this;
    }
    return (Result<T>) attemptRecoverFunction.apply(failure);
  }

    Result(@Nullable final T value, @Nullable final Throwable failure);

}