//
//  Generated by the J2ObjC translator.  DO NOT EDIT!
//  source: /Users/antoniocortes/j2objcprj/relases/j2objc/guava/build_result/java/com/google/common/util/concurrent/Futures.java
//

#include "../../../../../../J2ObjC_header.h"

#pragma push_macro("INCLUDE_ALL_ComGoogleCommonUtilConcurrentFutures")
#ifdef RESTRICT_ComGoogleCommonUtilConcurrentFutures
#define INCLUDE_ALL_ComGoogleCommonUtilConcurrentFutures 0
#else
#define INCLUDE_ALL_ComGoogleCommonUtilConcurrentFutures 1
#endif
#undef RESTRICT_ComGoogleCommonUtilConcurrentFutures

#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

#if __has_feature(nullability)
#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wnullability"
#pragma GCC diagnostic ignored "-Wnullability-completeness"
#endif

#if !defined (ComGoogleCommonUtilConcurrentFutures_) && (INCLUDE_ALL_ComGoogleCommonUtilConcurrentFutures || defined(INCLUDE_ComGoogleCommonUtilConcurrentFutures))
#define ComGoogleCommonUtilConcurrentFutures_

#define RESTRICT_ComGoogleCommonUtilConcurrentGwtFuturesCatchingSpecialization 1
#define INCLUDE_ComGoogleCommonUtilConcurrentGwtFuturesCatchingSpecialization 1
#include "../../../../../../com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.h"

@class ComGoogleCommonCollectImmutableList;
@class ComGoogleCommonUtilConcurrentFutures_FutureCombiner;
@class IOSClass;
@class IOSObjectArray;
@class JavaLangException;
@class JavaLangThrowable;
@class JavaUtilConcurrentTimeUnit;
@protocol ComGoogleCommonBaseFunction;
@protocol ComGoogleCommonUtilConcurrentAsyncCallable;
@protocol ComGoogleCommonUtilConcurrentAsyncFunction;
@protocol ComGoogleCommonUtilConcurrentCheckedFuture;
@protocol ComGoogleCommonUtilConcurrentFutureCallback;
@protocol ComGoogleCommonUtilConcurrentListenableFuture;
@protocol JavaLangIterable;
@protocol JavaUtilConcurrentExecutor;
@protocol JavaUtilConcurrentFuture;
@protocol JavaUtilConcurrentScheduledExecutorService;

/*!
 @brief Static utility methods pertaining to the <code>Future</code> interface.
 <p>Many of these methods use the <code>ListenableFuture</code> API; consult the Guava User Guide
  article on <a href="https://github.com/google/guava/wiki/ListenableFutureExplained"><code>ListenableFuture</code>
 </a>.
  
 <p>The main purpose of <code>ListenableFuture</code> is to help you chain together a graph of
  asynchronous operations. You can chain them together manually with calls to methods like <code>Futures.transform</code>
 , but you will often
  find it easier to use a framework. Frameworks automate the process, often adding features like
  monitoring, debugging, and cancellation. Examples of frameworks include: 
 <ul>
    <li><a href="http://google.github.io/dagger/producers.html">Dagger Producers</a>
  </ul>
  
 <p>If you do chain your operations manually, you may want to use <code>FluentFuture</code>.
 @author Kevin Bourrillion
 @author Nishant Thakkar
 @author Sven Mawson
 @since 1.0
 */
@interface ComGoogleCommonUtilConcurrentFutures : ComGoogleCommonUtilConcurrentGwtFuturesCatchingSpecialization

#pragma mark Public

/*!
 @brief Registers separate success and failure callbacks to be run when the <code>Future</code>'s
  computation is complete or, if the
  computation is already complete, immediately.
 <p>There is no guaranteed ordering of execution of callbacks, but any callback added through
  this method is guaranteed to be called once the computation is complete. 
 <p>Example:
  
 @code
 ListenableFuture<QueryResult> future = ...;
  addCallback(future,
      new FutureCallback<QueryResult>() {
        public void onSuccess(QueryResult result) {
          storeInCache(result);
        }
        public void onFailure(Throwable t) {
          reportError(t);
        }
      }); 
 
@endcode
  
 <p>This overload, which does not accept an executor, uses <code>directExecutor</code>, a dangerous
  choice in some cases. See the discussion in the <code>ListenableFuture.addListener</code>
  documentation. All its warnings about heavyweight listeners are
  also applicable to heavyweight callbacks passed to this method. 
 <p>For a more general interface to attach a completion listener to a <code>Future</code>, see <code>addListener</code>
 .
 @param future The future attach the callback to.
 @param callback The callback to invoke when <code>future</code>  is completed.
 @since 10.0
 */
+ (void)addCallbackWithComGoogleCommonUtilConcurrentListenableFuture:(id<ComGoogleCommonUtilConcurrentListenableFuture>)future
                     withComGoogleCommonUtilConcurrentFutureCallback:(id<ComGoogleCommonUtilConcurrentFutureCallback>)callback __attribute__((deprecated));

/*!
 @brief Registers separate success and failure callbacks to be run when the <code>Future</code>'s
  computation is complete or, if the
  computation is already complete, immediately.
 <p>The callback is run on <code>executor</code>. There is no guaranteed ordering of execution of
  callbacks, but any callback added through this method is guaranteed to be called once the
  computation is complete. 
 <p>Example:
  
 @code
 ListenableFuture<QueryResult> future = ...;
  Executor e = ...
  addCallback(future,
      new FutureCallback<QueryResult>() {
        public void onSuccess(QueryResult result) {
          storeInCache(result);
        }
        public void onFailure(Throwable t) {
          reportError(t);
        }
      }, e); 
 
@endcode
  
 <p>When selecting an executor, note that <code>directExecutor</code> is dangerous in some cases. See
  the discussion in the <code>ListenableFuture.addListener</code>
  documentation. All its warnings about heavyweight listeners are also applicable to heavyweight
  callbacks passed to this method. 
 <p>For a more general interface to attach a completion listener to a <code>Future</code>, see <code>addListener</code>
 .
 @param future The future attach the callback to.
 @param callback The callback to invoke when <code>future</code>  is completed.
 @param executor The executor to run <code>callback</code>  when the future completes.
 @since 10.0
 */
+ (void)addCallbackWithComGoogleCommonUtilConcurrentListenableFuture:(id<ComGoogleCommonUtilConcurrentListenableFuture>)future
                     withComGoogleCommonUtilConcurrentFutureCallback:(id<ComGoogleCommonUtilConcurrentFutureCallback>)callback
                                      withJavaUtilConcurrentExecutor:(id<JavaUtilConcurrentExecutor>)executor;

/*!
 @brief Creates a new <code>ListenableFuture</code> whose value is a list containing the values of all its
  input futures, if all succeed.
 <p>The list of results is in the same order as the input list. 
 <p>Canceling this future will attempt to cancel all the component futures, and if any of the
  provided futures fails or is canceled, this one is, too.
 @param futures futures to combine
 @return a future that provides a list of the results of the component futures
 @since 10.0
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)allAsListWithJavaLangIterable:(id<JavaLangIterable>)futures;

/*!
 @brief Creates a new <code>ListenableFuture</code> whose value is a list containing the values of all its
  input futures, if all succeed.
 <p>The list of results is in the same order as the input list. 
 <p>Canceling this future will attempt to cancel all the component futures, and if any of the
  provided futures fails or is canceled, this one is, too.
 @param futures futures to combine
 @return a future that provides a list of the results of the component futures
 @since 10.0
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)allAsListWithComGoogleCommonUtilConcurrentListenableFutureArray:(IOSObjectArray *)futures;

/*!
 @brief Returns a <code>Future</code> whose result is taken from the given primary <code>input</code> or, if the
  primary input fails with the given <code>exceptionType</code>, from the result provided by the 
 <code>fallback</code>.
 <code>Function.apply</code> is not invoked until the primary input has failed, so
  if the primary input succeeds, it is never invoked. If, during the invocation of <code>fallback</code>
 , an exception is thrown, this exception is used as the result of the output <code>Future</code>
 .
  
 <p>Usage example: 
 @code
 ListenableFuture<Integer> fetchCounterFuture = ...;
  // Falling back to a zero counter in case an exception happens when
  // processing the RPC to fetch counters.
  ListenableFuture<Integer> faultTolerantFuture = Futures.catching(
      fetchCounterFuture, FetchException.class, x -> 0); 
 
@endcode
  
 <p>This overload, which does not accept an executor, uses <code>directExecutor</code>, a dangerous
  choice in some cases. See the discussion in the <code>ListenableFuture.addListener</code>
  documentation. All its warnings about heavyweight listeners are
  also applicable to heavyweight functions passed to this method.
 @param input the primary input <code>Future</code>
 @param exceptionType the exception type that triggers use of <code>fallback</code> . The exception
       type is matched against the input's exception. "The input's exception" means the cause of      the 
 <code>ExecutionException</code>  thrown by <code>input.get()</code>  or, if <code>get()</code>  throws a      different kind of exception, that exception itself. To avoid hiding bugs and other
       unrecoverable errors, callers should prefer more specific types, avoiding 
 <code>Throwable.class</code>
   in particular.
 @param fallback the <code>Function</code>  to be called if <code>input</code>  fails with the expected
       exception type. The function's argument is the input's exception. "The input's exception"      means the cause of the 
 <code>ExecutionException</code>  thrown by <code>input.get()</code>  or, if      
 <code>get()</code>  throws a different kind of exception, that exception itself.
 @since 19.0
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)catchingWithComGoogleCommonUtilConcurrentListenableFuture:(id<ComGoogleCommonUtilConcurrentListenableFuture>)input
                                                                                                  withIOSClass:(IOSClass *)exceptionType
                                                                               withComGoogleCommonBaseFunction:(id<ComGoogleCommonBaseFunction>)fallback __attribute__((deprecated));

/*!
 @brief Returns a <code>Future</code> whose result is taken from the given primary <code>input</code> or, if the
  primary input fails with the given <code>exceptionType</code>, from the result provided by the 
 <code>fallback</code>.
 <code>Function.apply</code> is not invoked until the primary input has failed, so
  if the primary input succeeds, it is never invoked. If, during the invocation of <code>fallback</code>
 , an exception is thrown, this exception is used as the result of the output <code>Future</code>
 .
  
 <p>Usage example: 
 @code
 ListenableFuture<Integer> fetchCounterFuture = ...;
  // Falling back to a zero counter in case an exception happens when
  // processing the RPC to fetch counters.
  ListenableFuture<Integer> faultTolerantFuture = Futures.catching(
      fetchCounterFuture, FetchException.class, x -> 0, directExecutor()); 
 
@endcode
  
 <p>When selecting an executor, note that <code>directExecutor</code> is dangerous in some cases. See
  the discussion in the <code>ListenableFuture.addListener</code>
  documentation. All its warnings about heavyweight listeners are also applicable to heavyweight
  functions passed to this method.
 @param input the primary input <code>Future</code>
 @param exceptionType the exception type that triggers use of <code>fallback</code> . The exception
       type is matched against the input's exception. "The input's exception" means the cause of      the 
 <code>ExecutionException</code>  thrown by <code>input.get()</code>  or, if <code>get()</code>  throws a      different kind of exception, that exception itself. To avoid hiding bugs and other
       unrecoverable errors, callers should prefer more specific types, avoiding 
 <code>Throwable.class</code>
   in particular.
 @param fallback the <code>Function</code>  to be called if <code>input</code>  fails with the expected
       exception type. The function's argument is the input's exception. "The input's exception"      means the cause of the 
 <code>ExecutionException</code>  thrown by <code>input.get()</code>  or, if      
 <code>get()</code>  throws a different kind of exception, that exception itself.
 @param executor the executor that runs <code>fallback</code>  if <code>input</code>  fails
 @since 19.0
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)catchingWithComGoogleCommonUtilConcurrentListenableFuture:(id<ComGoogleCommonUtilConcurrentListenableFuture>)input
                                                                                                  withIOSClass:(IOSClass *)exceptionType
                                                                               withComGoogleCommonBaseFunction:(id<ComGoogleCommonBaseFunction>)fallback
                                                                                withJavaUtilConcurrentExecutor:(id<JavaUtilConcurrentExecutor>)executor;

/*!
 @brief Returns a <code>Future</code> whose result is taken from the given primary <code>input</code> or, if the
  primary input fails with the given <code>exceptionType</code>, from the result provided by the 
 <code>fallback</code>.
 <code>AsyncFunction.apply</code> is not invoked until the primary input has
  failed, so if the primary input succeeds, it is never invoked. If, during the invocation of 
 <code>fallback</code>, an exception is thrown, this exception is used as the result of the output 
 <code>Future</code>.
  
 <p>Usage examples: 
 @code
 ListenableFuture<Integer> fetchCounterFuture = ...;
  // Falling back to a zero counter in case an exception happens when
  // processing the RPC to fetch counters.
  ListenableFuture<Integer> faultTolerantFuture = Futures.catchingAsync(
      fetchCounterFuture, FetchException.class, x -> immediateFuture(0)); 
 
@endcode
  
 <p>The fallback can also choose to propagate the original exception when desired: 
 @code
 ListenableFuture<Integer> fetchCounterFuture = ...;
  // Falling back to a zero counter only in case the exception was a
  // TimeoutException.
  ListenableFuture<Integer> faultTolerantFuture = Futures.catchingAsync(
      fetchCounterFuture,
      FetchException.class,
      e -> {
        if (omitDataOnFetchFailure) {
          return immediateFuture(0);
        }
        throw e;
      }); 
 
@endcode
  
 <p>This overload, which does not accept an executor, uses <code>directExecutor</code>, a dangerous
  choice in some cases. See the discussion in the <code>ListenableFuture.addListener</code>
  documentation. All its warnings about heavyweight listeners are
  also applicable to heavyweight functions passed to this method. (Specifically, <code>directExecutor</code>
  functions should avoid heavyweight operations inside <code>AsyncFunction.apply</code>
 . Any heavyweight operations should occur in other threads responsible for
  completing the returned <code>Future</code>.)
 @param input the primary input <code>Future</code>
 @param exceptionType the exception type that triggers use of <code>fallback</code> . The exception
       type is matched against the input's exception. "The input's exception" means the cause of      the 
 <code>ExecutionException</code>  thrown by <code>input.get()</code>  or, if <code>get()</code>  throws a      different kind of exception, that exception itself. To avoid hiding bugs and other
       unrecoverable errors, callers should prefer more specific types, avoiding 
 <code>Throwable.class</code>
   in particular.
 @param fallback the <code>AsyncFunction</code>  to be called if <code>input</code>  fails with the expected
       exception type. The function's argument is the input's exception. "The input's exception"      means the cause of the 
 <code>ExecutionException</code>  thrown by <code>input.get()</code>  or, if      
 <code>get()</code>  throws a different kind of exception, that exception itself.
 @since 19.0 (similar functionality in 14.0 as <code>withFallback</code>)
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)catchingAsyncWithComGoogleCommonUtilConcurrentListenableFuture:(id<ComGoogleCommonUtilConcurrentListenableFuture>)input
                                                                                                       withIOSClass:(IOSClass *)exceptionType
                                                                     withComGoogleCommonUtilConcurrentAsyncFunction:(id<ComGoogleCommonUtilConcurrentAsyncFunction>)fallback __attribute__((deprecated));

/*!
 @brief Returns a <code>Future</code> whose result is taken from the given primary <code>input</code> or, if the
  primary input fails with the given <code>exceptionType</code>, from the result provided by the 
 <code>fallback</code>.
 <code>AsyncFunction.apply</code> is not invoked until the primary input has
  failed, so if the primary input succeeds, it is never invoked. If, during the invocation of 
 <code>fallback</code>, an exception is thrown, this exception is used as the result of the output 
 <code>Future</code>.
  
 <p>Usage examples: 
 @code
 ListenableFuture<Integer> fetchCounterFuture = ...;
  // Falling back to a zero counter in case an exception happens when
  // processing the RPC to fetch counters.
  ListenableFuture<Integer> faultTolerantFuture = Futures.catchingAsync(
      fetchCounterFuture, FetchException.class, x -> immediateFuture(0), directExecutor()); 
 
@endcode
  
 <p>The fallback can also choose to propagate the original exception when desired: 
 @code
 ListenableFuture<Integer> fetchCounterFuture = ...;
  // Falling back to a zero counter only in case the exception was a
  // TimeoutException.
  ListenableFuture<Integer> faultTolerantFuture = Futures.catchingAsync(
      fetchCounterFuture,
      FetchException.class,
      e -> {
        if (omitDataOnFetchFailure) {
          return immediateFuture(0);
        }
        throw e;
      },
      directExecutor()); 
 
@endcode
  
 <p>When selecting an executor, note that <code>directExecutor</code> is dangerous in some cases. See
  the discussion in the <code>ListenableFuture.addListener</code>
  documentation. All its warnings about heavyweight listeners are also applicable to heavyweight
  functions passed to this method. (Specifically, <code>directExecutor</code> functions should avoid
  heavyweight operations inside <code>AsyncFunction.apply</code>. Any heavyweight operations should
  occur in other threads responsible for completing the returned <code>Future</code>.)
 @param input the primary input <code>Future</code>
 @param exceptionType the exception type that triggers use of <code>fallback</code> . The exception
       type is matched against the input's exception. "The input's exception" means the cause of      the 
 <code>ExecutionException</code>  thrown by <code>input.get()</code>  or, if <code>get()</code>  throws a      different kind of exception, that exception itself. To avoid hiding bugs and other
       unrecoverable errors, callers should prefer more specific types, avoiding 
 <code>Throwable.class</code>
   in particular.
 @param fallback the <code>AsyncFunction</code>  to be called if <code>input</code>  fails with the expected
       exception type. The function's argument is the input's exception. "The input's exception"      means the cause of the 
 <code>ExecutionException</code>  thrown by <code>input.get()</code>  or, if      
 <code>get()</code>  throws a different kind of exception, that exception itself.
 @param executor the executor that runs <code>fallback</code>  if <code>input</code>  fails
 @since 19.0 (similar functionality in 14.0 as <code>withFallback</code>)
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)catchingAsyncWithComGoogleCommonUtilConcurrentListenableFuture:(id<ComGoogleCommonUtilConcurrentListenableFuture>)input
                                                                                                       withIOSClass:(IOSClass *)exceptionType
                                                                     withComGoogleCommonUtilConcurrentAsyncFunction:(id<ComGoogleCommonUtilConcurrentAsyncFunction>)fallback
                                                                                     withJavaUtilConcurrentExecutor:(id<JavaUtilConcurrentExecutor>)executor;

/*!
 @brief Returns the result of <code>Future.get()</code>, converting most exceptions to a new instance of the
  given checked exception type.This reduces boilerplate for a common use of <code>Future</code> in
  which it is unnecessary to programmatically distinguish between exception types or to extract
  other information from the exception instance.
 <p>Exceptions from <code>Future.get</code> are treated as follows: 
 <ul>
    <li>Any <code>ExecutionException</code> has its <i>cause</i> wrapped in an <code>X</code> if the cause
        is a checked exception, an <code>UncheckedExecutionException</code> if the cause is a <code>RuntimeException</code>
 , or an <code>ExecutionError</code> if the cause is an <code>Error</code>.
    <li>Any <code>InterruptedException</code> is wrapped in an <code>X</code> (after restoring the
        interrupt).   
 <li>Any <code>CancellationException</code> is propagated untouched, as is any other <code>RuntimeException</code>
  (though <code>get</code> implementations are discouraged from throwing such
        exceptions). 
 </ul>
  
 <p>The overall principle is to continue to treat every checked exception as a checked
  exception, every unchecked exception as an unchecked exception, and every error as an error. In
  addition, the cause of any <code>ExecutionException</code> is wrapped in order to ensure that the
  new stack trace matches that of the current thread. 
 <p>Instances of <code>exceptionClass</code> are created by choosing an arbitrary public constructor
  that accepts zero or more arguments, all of type <code>String</code> or <code>Throwable</code>
  (preferring constructors with at least one <code>String</code>) and calling the constructor via
  reflection. If the exception did not already have a cause, one is set by calling <code>Throwable.initCause(Throwable)</code>
  on it. If no such constructor exists, an <code>IllegalArgumentException</code>
  is thrown.
 @throw Xif <code>get</code> throws any checked exception except for an <code>ExecutionException</code>
      whose cause is not itself a checked exception
 @throw UncheckedExecutionExceptionif <code>get</code> throws an <code>ExecutionException</code> with a
      <code>RuntimeException</code> as its cause
 @throw ExecutionErrorif <code>get</code> throws an <code>ExecutionException</code> with an <code>Error</code>
  as its cause
 @throw CancellationExceptionif <code>get</code> throws a <code>CancellationException</code>
 @throw IllegalArgumentExceptionif <code>exceptionClass</code> extends <code>RuntimeException</code> or
      does not have a suitable constructor
 @since 19.0 (in 10.0 as <code>get</code>)
 */
+ (id)getCheckedWithJavaUtilConcurrentFuture:(id<JavaUtilConcurrentFuture>)future
                                withIOSClass:(IOSClass *)exceptionClass;

/*!
 @brief Returns the result of <code>TimeUnit)</code>, converting most exceptions to a new
  instance of the given checked exception type.This reduces boilerplate for a common use of 
 <code>Future</code> in which it is unnecessary to programmatically distinguish between exception
  types or to extract other information from the exception instance.
 <p>Exceptions from <code>Future.get</code> are treated as follows: 
 <ul>
    <li>Any <code>ExecutionException</code> has its <i>cause</i> wrapped in an <code>X</code> if the cause
        is a checked exception, an <code>UncheckedExecutionException</code> if the cause is a <code>RuntimeException</code>
 , or an <code>ExecutionError</code> if the cause is an <code>Error</code>.
    <li>Any <code>InterruptedException</code> is wrapped in an <code>X</code> (after restoring the
        interrupt).   
 <li>Any <code>TimeoutException</code> is wrapped in an <code>X</code>.
    <li>Any <code>CancellationException</code> is propagated untouched, as is any other <code>RuntimeException</code>
  (though <code>get</code> implementations are discouraged from throwing such
        exceptions). 
 </ul>
  
 <p>The overall principle is to continue to treat every checked exception as a checked
  exception, every unchecked exception as an unchecked exception, and every error as an error. In
  addition, the cause of any <code>ExecutionException</code> is wrapped in order to ensure that the
  new stack trace matches that of the current thread. 
 <p>Instances of <code>exceptionClass</code> are created by choosing an arbitrary public constructor
  that accepts zero or more arguments, all of type <code>String</code> or <code>Throwable</code>
  (preferring constructors with at least one <code>String</code>) and calling the constructor via
  reflection. If the exception did not already have a cause, one is set by calling <code>Throwable.initCause(Throwable)</code>
  on it. If no such constructor exists, an <code>IllegalArgumentException</code>
  is thrown.
 @throw Xif <code>get</code> throws any checked exception except for an <code>ExecutionException</code>
      whose cause is not itself a checked exception
 @throw UncheckedExecutionExceptionif <code>get</code> throws an <code>ExecutionException</code> with a
      <code>RuntimeException</code> as its cause
 @throw ExecutionErrorif <code>get</code> throws an <code>ExecutionException</code> with an <code>Error</code>
  as its cause
 @throw CancellationExceptionif <code>get</code> throws a <code>CancellationException</code>
 @throw IllegalArgumentExceptionif <code>exceptionClass</code> extends <code>RuntimeException</code> or
      does not have a suitable constructor
 @since 19.0 (in 10.0 as <code>get</code> and with different parameter order)
 */
+ (id)getCheckedWithJavaUtilConcurrentFuture:(id<JavaUtilConcurrentFuture>)future
                                withIOSClass:(IOSClass *)exceptionClass
                                    withLong:(jlong)timeout
              withJavaUtilConcurrentTimeUnit:(JavaUtilConcurrentTimeUnit *)unit;

/*!
 @brief Returns the result of the input <code>Future</code>, which must have already completed.
 <p>The benefits of this method are twofold. First, the name "getDone" suggests to readers that the 
 <code>Future</code> is already done. Second, if buggy code calls <code>getDone</code> on a <code>Future</code>
  that is still pending, the program will throw instead of block. This can be important
  for APIs like <code>whenAllComplete(...)</code><code>.</code><code>call(...)</code>
 , where it is easy to use a new input from
  the <code>call</code> implementation but forget to add it to the arguments of <code>whenAllComplete</code>
 .
  
 <p>If you are looking for a method to determine whether a given <code>Future</code> is done, use the
  instance method <code>Future.isDone()</code>.
 @throw ExecutionExceptionif the <code>Future</code> failed with an exception
 @throw CancellationExceptionif the <code>Future</code> was cancelled
 @throw IllegalStateExceptionif the <code>Future</code> is not done
 @since 20.0
 */
+ (id)getDoneWithJavaUtilConcurrentFuture:(id<JavaUtilConcurrentFuture>)future;

/*!
 @brief Returns the result of calling <code>Future.get()</code> uninterruptibly on a task known not to throw
  a checked exception.This makes <code>Future</code> more suitable for lightweight, fast-running
  tasks that, barring bugs in the code, will not fail.
 This gives it exception-handling behavior
  similar to that of <code>ForkJoinTask.join</code>.
  
 <p>Exceptions from <code>Future.get</code> are treated as follows: 
 <ul>
    <li>Any <code>ExecutionException</code> has its <i>cause</i> wrapped in an <code>UncheckedExecutionException</code>
  (if the cause is an <code>Exception</code>) or <code>ExecutionError</code>
  (if the cause is an <code>Error</code>).
    <li>Any <code>InterruptedException</code> causes a retry of the <code>get</code> call. The interrupt is
        restored before <code>getUnchecked</code> returns.
    <li>Any <code>CancellationException</code> is propagated untouched. So is any other <code>RuntimeException</code>
  (<code>get</code> implementations are discouraged from throwing such
        exceptions). 
 </ul>
  
 <p>The overall principle is to eliminate all checked exceptions: to loop to avoid <code>InterruptedException</code>
 , to pass through <code>CancellationException</code>, and to wrap any exception
  from the underlying computation in an <code>UncheckedExecutionException</code> or <code>ExecutionError</code>
 .
  
 <p>For an uninterruptible <code>get</code> that preserves other exceptions, see <code>Uninterruptibles.getUninterruptibly(Future)</code>
 .
 @throw UncheckedExecutionExceptionif <code>get</code> throws an <code>ExecutionException</code> with an
      <code>Exception</code> as its cause
 @throw ExecutionErrorif <code>get</code> throws an <code>ExecutionException</code> with an <code>Error</code>
  as its cause
 @throw CancellationExceptionif <code>get</code> throws a <code>CancellationException</code>
 @since 10.0
 */
+ (id)getUncheckedWithJavaUtilConcurrentFuture:(id<JavaUtilConcurrentFuture>)future;

/*!
 @brief Creates a <code>ListenableFuture</code> which is cancelled immediately upon construction, so that 
 <code>isCancelled()</code> always returns <code>true</code>.
 @since 14.0
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)immediateCancelledFuture;

/*!
 @brief Returns a <code>CheckedFuture</code> which has its value set immediately upon construction.
 <p>The returned <code>Future</code> can't be cancelled, and its <code>isDone()</code> method always
  returns <code>true</code>. Calling <code>get()</code> or <code>checkedGet()</code> will immediately return the
  provided value.
 */
+ (id<ComGoogleCommonUtilConcurrentCheckedFuture>)immediateCheckedFutureWithId:(id)value __attribute__((deprecated));

/*!
 @brief Returns a <code>CheckedFuture</code> which has an exception set immediately upon construction.
 <p>The returned <code>Future</code> can't be cancelled, and its <code>isDone()</code> method always
  returns <code>true</code>. Calling <code>get()</code> will immediately throw the provided <code>Exception</code>
  wrapped in an <code>ExecutionException</code>, and calling <code>checkedGet()</code> will
  throw the provided exception itself.
 */
+ (id<ComGoogleCommonUtilConcurrentCheckedFuture>)immediateFailedCheckedFutureWithJavaLangException:(JavaLangException *)exception __attribute__((deprecated));

/*!
 @brief Returns a <code>ListenableFuture</code> which has an exception set immediately upon construction.
 <p>The returned <code>Future</code> can't be cancelled, and its <code>isDone()</code> method always
  returns <code>true</code>. Calling <code>get()</code> will immediately throw the provided <code>Throwable</code>
  wrapped in an <code>ExecutionException</code>.
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)immediateFailedFutureWithJavaLangThrowable:(JavaLangThrowable *)throwable;

/*!
 @brief Creates a <code>ListenableFuture</code> which has its value set immediately upon construction.The
  getters just return the value.
 This <code>Future</code> can't be canceled or timed out and its 
 <code>isDone()</code> method always returns <code>true</code>.
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)immediateFutureWithId:(id)value;

/*!
 @brief Returns a list of delegate futures that correspond to the futures received in the order that
  they complete.Delegate futures return the same value or throw the same exception as the
  corresponding input future returns/throws.
 <p>"In the order that they complete" means, for practical purposes, about what you would
  expect, but there are some subtleties. First, we do guarantee that, if the output future at
  index n is done, the output future at index n-1 is also done. (But as usual with futures, some
  listeners for future n may complete before some for future n-1.) However, it is possible, if
  one input completes with result X and another later with result Y, for Y to come before X in
  the output future list. (Such races are impossible to solve without global synchronization of
  all future completions. And they should have little practical impact.) 
 <p>Cancelling a delegate future propagates to input futures once all the delegates complete,
  either from cancellation or because an input future has completed. If N futures are passed in,
  and M delegates are cancelled, the remaining M input futures will be cancelled once N - M of
  the input futures complete. If all the delegates are cancelled, all the input futures will be
  too.
 @since 17.0
 */
+ (ComGoogleCommonCollectImmutableList *)inCompletionOrderWithJavaLangIterable:(id<JavaLangIterable>)futures;

/*!
 @brief Like <code>Function, Executor)</code> except that the transformation 
 <code>function</code> is invoked on each call to <code>get()</code> on the returned future.
 <p>The returned <code>Future</code> reflects the input's cancellation state directly, and any
  attempt to cancel the returned Future is likewise passed through to the input Future. 
 <p>Note that calls to get only apply the timeout
  to the execution of the underlying <code>Future</code>, <em>not</em> to the execution of the
  transformation function. 
 <p>The primary audience of this method is callers of <code>transform</code> who don't have a <code>ListenableFuture</code>
  available and do not mind repeated, lazy function evaluation.
 @param input The future to transform
 @param function A Function to transform the results of the provided future to the results of      the returned future.
 @return A future that returns the result of the transformation.
 @since 10.0
 */
+ (id<JavaUtilConcurrentFuture>)lazyTransformWithJavaUtilConcurrentFuture:(id<JavaUtilConcurrentFuture>)input
                                          withComGoogleCommonBaseFunction:(id<ComGoogleCommonBaseFunction>)function;

/*!
 @brief Creates a <code>CheckedFuture</code> out of a normal <code>ListenableFuture</code> and a <code>Function</code>
  that maps from <code>Exception</code> instances into the appropriate checked type.
 <p><b>Warning:</b> We recommend against using <code>CheckedFuture</code> in new projects. <code>CheckedFuture</code>
  is difficult to build libraries atop. <code>CheckedFuture</code> ports of methods
  like <code>Futures.transformAsync</code> have historically had bugs, and some of these bugs are
  necessary, unavoidable consequences of the <code>CheckedFuture</code> API. Additionally, <code>CheckedFuture</code>
  encourages users to take exceptions from one thread and rethrow them in another,
  producing confusing stack traces. 
 <p>The given mapping function will be applied to an <code>InterruptedException</code>, a <code>CancellationException</code>
 , or an <code>ExecutionException</code>. See <code>Future.get()</code> for details
  on the exceptions thrown.
 @since 9.0 (source-compatible since 1.0)
 */
+ (id<ComGoogleCommonUtilConcurrentCheckedFuture>)makeCheckedWithComGoogleCommonUtilConcurrentListenableFuture:(id<ComGoogleCommonUtilConcurrentListenableFuture>)future
                                                                               withComGoogleCommonBaseFunction:(id<ComGoogleCommonBaseFunction>)mapper __attribute__((deprecated));

/*!
 @brief Returns a <code>ListenableFuture</code> whose result is set from the supplied future when it
  completes.Cancelling the supplied future will also cancel the returned future, but cancelling
  the returned future will have no effect on the supplied future.
 @since 15.0
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)nonCancellationPropagatingWithComGoogleCommonUtilConcurrentListenableFuture:(id<ComGoogleCommonUtilConcurrentListenableFuture>)future;

/*!
 @brief Schedules <code>callable</code> on the specified <code>executor</code>, returning a <code>Future</code>.
 @throw RejectedExecutionExceptionif the task cannot be scheduled for execution
 @since 23.0
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)scheduleAsyncWithComGoogleCommonUtilConcurrentAsyncCallable:(id<ComGoogleCommonUtilConcurrentAsyncCallable>)callable
                                                                                                        withLong:(jlong)delay
                                                                                  withJavaUtilConcurrentTimeUnit:(JavaUtilConcurrentTimeUnit *)timeUnit
                                                                  withJavaUtilConcurrentScheduledExecutorService:(id<JavaUtilConcurrentScheduledExecutorService>)executorService;

/*!
 @brief Executes <code>callable</code> on the specified <code>executor</code>, returning a <code>Future</code>.
 @throw RejectedExecutionExceptionif the task cannot be scheduled for execution
 @since 23.0
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)submitAsyncWithComGoogleCommonUtilConcurrentAsyncCallable:(id<ComGoogleCommonUtilConcurrentAsyncCallable>)callable
                                                                                withJavaUtilConcurrentExecutor:(id<JavaUtilConcurrentExecutor>)executor;

/*!
 @brief Creates a new <code>ListenableFuture</code> whose value is a list containing the values of all its
  successful input futures.The list of results is in the same order as the input list, and if
  any of the provided futures fails or is canceled, its corresponding position will contain 
 <code>null</code> (which is indistinguishable from the future having a successful value of <code>null</code>
 ).
 <p>Canceling this future will attempt to cancel all the component futures.
 @param futures futures to combine
 @return a future that provides a list of the results of the component futures
 @since 10.0
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)successfulAsListWithJavaLangIterable:(id<JavaLangIterable>)futures;

/*!
 @brief Creates a new <code>ListenableFuture</code> whose value is a list containing the values of all its
  successful input futures.The list of results is in the same order as the input list, and if
  any of the provided futures fails or is canceled, its corresponding position will contain 
 <code>null</code> (which is indistinguishable from the future having a successful value of <code>null</code>
 ).
 <p>Canceling this future will attempt to cancel all the component futures.
 @param futures futures to combine
 @return a future that provides a list of the results of the component futures
 @since 10.0
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)successfulAsListWithComGoogleCommonUtilConcurrentListenableFutureArray:(IOSObjectArray *)futures;

/*!
 @brief Returns a new <code>Future</code> whose result is derived from the result of the given <code>Future</code>
 .If <code>input</code> fails, the returned <code>Future</code> fails with the same exception (and
  the function is not invoked).
 Example usage: 
 @code
 ListenableFuture<QueryResult> queryFuture = ...;
  ListenableFuture<List<Row>> rowsFuture =
      transform(queryFuture, QueryResult::getRows); 
 
@endcode
  
 <p>This overload, which does not accept an executor, uses <code>directExecutor</code>, a dangerous
  choice in some cases. See the discussion in the <code>ListenableFuture.addListener</code>
  documentation. All its warnings about heavyweight listeners are
  also applicable to heavyweight functions passed to this method. 
 <p>The returned <code>Future</code> attempts to keep its cancellation state in sync with that of the
  input future. That is, if the returned <code>Future</code> is cancelled, it will attempt to cancel
  the input, and if the input is cancelled, the returned <code>Future</code> will receive a callback
  in which it will attempt to cancel itself. 
 <p>An example use of this method is to convert a serializable object returned from an RPC into
  a POJO.
 @param input The future to transform
 @param function A Function to transform the results of the provided future to the results of      the returned future. This will be run in the thread that notifies input it is complete.
 @return A future that holds result of the transformation.
 @since 9.0 (in 1.0 as <code>compose</code>)
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)transformWithComGoogleCommonUtilConcurrentListenableFuture:(id<ComGoogleCommonUtilConcurrentListenableFuture>)input
                                                                                withComGoogleCommonBaseFunction:(id<ComGoogleCommonBaseFunction>)function __attribute__((deprecated));

/*!
 @brief Returns a new <code>Future</code> whose result is derived from the result of the given <code>Future</code>
 .If <code>input</code> fails, the returned <code>Future</code> fails with the same exception (and
  the function is not invoked).
 Example usage: 
 @code
 ListenableFuture<QueryResult> queryFuture = ...;
  ListenableFuture<List<Row>> rowsFuture =
      transform(queryFuture, QueryResult::getRows, executor); 
 
@endcode
  
 <p>When selecting an executor, note that <code>directExecutor</code> is dangerous in some cases. See
  the discussion in the <code>ListenableFuture.addListener</code>
  documentation. All its warnings about heavyweight listeners are also applicable to heavyweight
  functions passed to this method. 
 <p>The returned <code>Future</code> attempts to keep its cancellation state in sync with that of the
  input future. That is, if the returned <code>Future</code> is cancelled, it will attempt to cancel
  the input, and if the input is cancelled, the returned <code>Future</code> will receive a callback
  in which it will attempt to cancel itself. 
 <p>An example use of this method is to convert a serializable object returned from an RPC into
  a POJO.
 @param input The future to transform
 @param function A Function to transform the results of the provided future to the results of      the returned future.
 @param executor Executor to run the function in.
 @return A future that holds result of the transformation.
 @since 9.0 (in 2.0 as <code>compose</code>)
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)transformWithComGoogleCommonUtilConcurrentListenableFuture:(id<ComGoogleCommonUtilConcurrentListenableFuture>)input
                                                                                withComGoogleCommonBaseFunction:(id<ComGoogleCommonBaseFunction>)function
                                                                                 withJavaUtilConcurrentExecutor:(id<JavaUtilConcurrentExecutor>)executor;

/*!
 @brief Returns a new <code>Future</code> whose result is asynchronously derived from the result of the
  given <code>Future</code>.If the given <code>Future</code> fails, the returned <code>Future</code> fails with
  the same exception (and the function is not invoked).
 <p>More precisely, the returned <code>Future</code> takes its result from a <code>Future</code> produced
  by applying the given <code>AsyncFunction</code> to the result of the original <code>Future</code>.
  Example usage: 
 @code
 ListenableFuture<RowKey> rowKeyFuture = indexService.lookUp(query);
  ListenableFuture<QueryResult> queryFuture =
      transformAsync(rowKeyFuture, dataService::readFuture); 
 
@endcode
  
 <p>This overload, which does not accept an executor, uses <code>directExecutor</code>, a dangerous
  choice in some cases. See the discussion in the <code>ListenableFuture.addListener</code>
  documentation. All its warnings about heavyweight listeners are
  also applicable to heavyweight functions passed to this method. (Specifically, <code>directExecutor</code>
  functions should avoid heavyweight operations inside <code>AsyncFunction.apply</code>
 . Any heavyweight operations should occur in other threads responsible for
  completing the returned <code>Future</code>.)
  
 <p>The returned <code>Future</code> attempts to keep its cancellation state in sync with that of the
  input future and that of the future returned by the function. That is, if the returned <code>Future</code>
  is cancelled, it will attempt to cancel the other two, and if either of the other two
  is cancelled, the returned <code>Future</code> will receive a callback in which it will attempt to
  cancel itself.
 @param input The future to transform
 @param function A function to transform the result of the input future to the result of the      output future
 @return A future that holds result of the function (if the input succeeded) or the original
      input's failure (if not)
 @since 19.0 (in 11.0 as <code>transform</code>)
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)transformAsyncWithComGoogleCommonUtilConcurrentListenableFuture:(id<ComGoogleCommonUtilConcurrentListenableFuture>)input
                                                                      withComGoogleCommonUtilConcurrentAsyncFunction:(id<ComGoogleCommonUtilConcurrentAsyncFunction>)function __attribute__((deprecated));

/*!
 @brief Returns a new <code>Future</code> whose result is asynchronously derived from the result of the
  given <code>Future</code>.If the given <code>Future</code> fails, the returned <code>Future</code> fails with
  the same exception (and the function is not invoked).
 <p>More precisely, the returned <code>Future</code> takes its result from a <code>Future</code> produced
  by applying the given <code>AsyncFunction</code> to the result of the original <code>Future</code>.
  Example usage: 
 @code
 ListenableFuture<RowKey> rowKeyFuture = indexService.lookUp(query);
  ListenableFuture<QueryResult> queryFuture =
      transformAsync(rowKeyFuture, dataService::readFuture, executor); 
 
@endcode
  
 <p>When selecting an executor, note that <code>directExecutor</code> is dangerous in some cases. See
  the discussion in the <code>ListenableFuture.addListener</code>
  documentation. All its warnings about heavyweight listeners are also applicable to heavyweight
  functions passed to this method. (Specifically, <code>directExecutor</code> functions should avoid
  heavyweight operations inside <code>AsyncFunction.apply</code>. Any heavyweight operations should
  occur in other threads responsible for completing the returned <code>Future</code>.)
  
 <p>The returned <code>Future</code> attempts to keep its cancellation state in sync with that of the
  input future and that of the future returned by the chain function. That is, if the returned 
 <code>Future</code> is cancelled, it will attempt to cancel the other two, and if either of the
  other two is cancelled, the returned <code>Future</code> will receive a callback in which it will
  attempt to cancel itself.
 @param input The future to transform
 @param function A function to transform the result of the input future to the result of the      output future
 @param executor Executor to run the function in.
 @return A future that holds result of the function (if the input succeeded) or the original
      input's failure (if not)
 @since 19.0 (in 11.0 as <code>transform</code>)
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)transformAsyncWithComGoogleCommonUtilConcurrentListenableFuture:(id<ComGoogleCommonUtilConcurrentListenableFuture>)input
                                                                      withComGoogleCommonUtilConcurrentAsyncFunction:(id<ComGoogleCommonUtilConcurrentAsyncFunction>)function
                                                                                      withJavaUtilConcurrentExecutor:(id<JavaUtilConcurrentExecutor>)executor;

/*!
 @brief Creates a <code>FutureCombiner</code> that processes the completed futures whether or not they're
  successful.
 @since 20.0
 */
+ (ComGoogleCommonUtilConcurrentFutures_FutureCombiner *)whenAllCompleteWithJavaLangIterable:(id<JavaLangIterable>)futures;

/*!
 @brief Creates a <code>FutureCombiner</code> that processes the completed futures whether or not they're
  successful.
 @since 20.0
 */
+ (ComGoogleCommonUtilConcurrentFutures_FutureCombiner *)whenAllCompleteWithComGoogleCommonUtilConcurrentListenableFutureArray:(IOSObjectArray *)futures;

/*!
 @brief Creates a <code>FutureCombiner</code> requiring that all passed in futures are successful.
 <p>If any input fails, the returned future fails immediately.
 @since 20.0
 */
+ (ComGoogleCommonUtilConcurrentFutures_FutureCombiner *)whenAllSucceedWithJavaLangIterable:(id<JavaLangIterable>)futures;

/*!
 @brief Creates a <code>FutureCombiner</code> requiring that all passed in futures are successful.
 <p>If any input fails, the returned future fails immediately.
 @since 20.0
 */
+ (ComGoogleCommonUtilConcurrentFutures_FutureCombiner *)whenAllSucceedWithComGoogleCommonUtilConcurrentListenableFutureArray:(IOSObjectArray *)futures;

/*!
 @brief Returns a future that delegates to another but will finish early (via a <code>TimeoutException</code>
  wrapped in an <code>ExecutionException</code>) if the specified duration expires.
 <p>The delegate future is interrupted and cancelled if it times out.
 @param delegate The future to delegate to.
 @param time when to timeout the future
 @param unit the time unit of the time parameter
 @param scheduledExecutor The executor service to enforce the timeout.
 @since 19.0
 */
+ (id<ComGoogleCommonUtilConcurrentListenableFuture>)withTimeoutWithComGoogleCommonUtilConcurrentListenableFuture:(id<ComGoogleCommonUtilConcurrentListenableFuture>)delegate
                                                                                                         withLong:(jlong)time
                                                                                   withJavaUtilConcurrentTimeUnit:(JavaUtilConcurrentTimeUnit *)unit
                                                                   withJavaUtilConcurrentScheduledExecutorService:(id<JavaUtilConcurrentScheduledExecutorService>)scheduledExecutor;

@end

J2OBJC_EMPTY_STATIC_INIT(ComGoogleCommonUtilConcurrentFutures)

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentCheckedFuture> ComGoogleCommonUtilConcurrentFutures_makeCheckedWithComGoogleCommonUtilConcurrentListenableFuture_withComGoogleCommonBaseFunction_(id<ComGoogleCommonUtilConcurrentListenableFuture> future, id<ComGoogleCommonBaseFunction> mapper);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_immediateFutureWithId_(id value);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentCheckedFuture> ComGoogleCommonUtilConcurrentFutures_immediateCheckedFutureWithId_(id value);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_immediateFailedFutureWithJavaLangThrowable_(JavaLangThrowable *throwable);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_immediateCancelledFuture(void);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentCheckedFuture> ComGoogleCommonUtilConcurrentFutures_immediateFailedCheckedFutureWithJavaLangException_(JavaLangException *exception);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_submitAsyncWithComGoogleCommonUtilConcurrentAsyncCallable_withJavaUtilConcurrentExecutor_(id<ComGoogleCommonUtilConcurrentAsyncCallable> callable, id<JavaUtilConcurrentExecutor> executor);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_scheduleAsyncWithComGoogleCommonUtilConcurrentAsyncCallable_withLong_withJavaUtilConcurrentTimeUnit_withJavaUtilConcurrentScheduledExecutorService_(id<ComGoogleCommonUtilConcurrentAsyncCallable> callable, jlong delay, JavaUtilConcurrentTimeUnit *timeUnit, id<JavaUtilConcurrentScheduledExecutorService> executorService);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_catchingWithComGoogleCommonUtilConcurrentListenableFuture_withIOSClass_withComGoogleCommonBaseFunction_(id<ComGoogleCommonUtilConcurrentListenableFuture> input, IOSClass *exceptionType, id<ComGoogleCommonBaseFunction> fallback);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_catchingWithComGoogleCommonUtilConcurrentListenableFuture_withIOSClass_withComGoogleCommonBaseFunction_withJavaUtilConcurrentExecutor_(id<ComGoogleCommonUtilConcurrentListenableFuture> input, IOSClass *exceptionType, id<ComGoogleCommonBaseFunction> fallback, id<JavaUtilConcurrentExecutor> executor);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_catchingAsyncWithComGoogleCommonUtilConcurrentListenableFuture_withIOSClass_withComGoogleCommonUtilConcurrentAsyncFunction_(id<ComGoogleCommonUtilConcurrentListenableFuture> input, IOSClass *exceptionType, id<ComGoogleCommonUtilConcurrentAsyncFunction> fallback);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_catchingAsyncWithComGoogleCommonUtilConcurrentListenableFuture_withIOSClass_withComGoogleCommonUtilConcurrentAsyncFunction_withJavaUtilConcurrentExecutor_(id<ComGoogleCommonUtilConcurrentListenableFuture> input, IOSClass *exceptionType, id<ComGoogleCommonUtilConcurrentAsyncFunction> fallback, id<JavaUtilConcurrentExecutor> executor);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_withTimeoutWithComGoogleCommonUtilConcurrentListenableFuture_withLong_withJavaUtilConcurrentTimeUnit_withJavaUtilConcurrentScheduledExecutorService_(id<ComGoogleCommonUtilConcurrentListenableFuture> delegate, jlong time, JavaUtilConcurrentTimeUnit *unit, id<JavaUtilConcurrentScheduledExecutorService> scheduledExecutor);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_transformAsyncWithComGoogleCommonUtilConcurrentListenableFuture_withComGoogleCommonUtilConcurrentAsyncFunction_(id<ComGoogleCommonUtilConcurrentListenableFuture> input, id<ComGoogleCommonUtilConcurrentAsyncFunction> function);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_transformAsyncWithComGoogleCommonUtilConcurrentListenableFuture_withComGoogleCommonUtilConcurrentAsyncFunction_withJavaUtilConcurrentExecutor_(id<ComGoogleCommonUtilConcurrentListenableFuture> input, id<ComGoogleCommonUtilConcurrentAsyncFunction> function, id<JavaUtilConcurrentExecutor> executor);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_transformWithComGoogleCommonUtilConcurrentListenableFuture_withComGoogleCommonBaseFunction_(id<ComGoogleCommonUtilConcurrentListenableFuture> input, id<ComGoogleCommonBaseFunction> function);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_transformWithComGoogleCommonUtilConcurrentListenableFuture_withComGoogleCommonBaseFunction_withJavaUtilConcurrentExecutor_(id<ComGoogleCommonUtilConcurrentListenableFuture> input, id<ComGoogleCommonBaseFunction> function, id<JavaUtilConcurrentExecutor> executor);

FOUNDATION_EXPORT id<JavaUtilConcurrentFuture> ComGoogleCommonUtilConcurrentFutures_lazyTransformWithJavaUtilConcurrentFuture_withComGoogleCommonBaseFunction_(id<JavaUtilConcurrentFuture> input, id<ComGoogleCommonBaseFunction> function);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_allAsListWithComGoogleCommonUtilConcurrentListenableFutureArray_(IOSObjectArray *futures);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_allAsListWithJavaLangIterable_(id<JavaLangIterable> futures);

FOUNDATION_EXPORT ComGoogleCommonUtilConcurrentFutures_FutureCombiner *ComGoogleCommonUtilConcurrentFutures_whenAllCompleteWithComGoogleCommonUtilConcurrentListenableFutureArray_(IOSObjectArray *futures);

FOUNDATION_EXPORT ComGoogleCommonUtilConcurrentFutures_FutureCombiner *ComGoogleCommonUtilConcurrentFutures_whenAllCompleteWithJavaLangIterable_(id<JavaLangIterable> futures);

FOUNDATION_EXPORT ComGoogleCommonUtilConcurrentFutures_FutureCombiner *ComGoogleCommonUtilConcurrentFutures_whenAllSucceedWithComGoogleCommonUtilConcurrentListenableFutureArray_(IOSObjectArray *futures);

FOUNDATION_EXPORT ComGoogleCommonUtilConcurrentFutures_FutureCombiner *ComGoogleCommonUtilConcurrentFutures_whenAllSucceedWithJavaLangIterable_(id<JavaLangIterable> futures);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_nonCancellationPropagatingWithComGoogleCommonUtilConcurrentListenableFuture_(id<ComGoogleCommonUtilConcurrentListenableFuture> future);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_successfulAsListWithComGoogleCommonUtilConcurrentListenableFutureArray_(IOSObjectArray *futures);

FOUNDATION_EXPORT id<ComGoogleCommonUtilConcurrentListenableFuture> ComGoogleCommonUtilConcurrentFutures_successfulAsListWithJavaLangIterable_(id<JavaLangIterable> futures);

FOUNDATION_EXPORT ComGoogleCommonCollectImmutableList *ComGoogleCommonUtilConcurrentFutures_inCompletionOrderWithJavaLangIterable_(id<JavaLangIterable> futures);

FOUNDATION_EXPORT void ComGoogleCommonUtilConcurrentFutures_addCallbackWithComGoogleCommonUtilConcurrentListenableFuture_withComGoogleCommonUtilConcurrentFutureCallback_(id<ComGoogleCommonUtilConcurrentListenableFuture> future, id<ComGoogleCommonUtilConcurrentFutureCallback> callback);

FOUNDATION_EXPORT void ComGoogleCommonUtilConcurrentFutures_addCallbackWithComGoogleCommonUtilConcurrentListenableFuture_withComGoogleCommonUtilConcurrentFutureCallback_withJavaUtilConcurrentExecutor_(id<ComGoogleCommonUtilConcurrentListenableFuture> future, id<ComGoogleCommonUtilConcurrentFutureCallback> callback, id<JavaUtilConcurrentExecutor> executor);

FOUNDATION_EXPORT id ComGoogleCommonUtilConcurrentFutures_getDoneWithJavaUtilConcurrentFuture_(id<JavaUtilConcurrentFuture> future);

FOUNDATION_EXPORT id ComGoogleCommonUtilConcurrentFutures_getCheckedWithJavaUtilConcurrentFuture_withIOSClass_(id<JavaUtilConcurrentFuture> future, IOSClass *exceptionClass);

FOUNDATION_EXPORT id ComGoogleCommonUtilConcurrentFutures_getCheckedWithJavaUtilConcurrentFuture_withIOSClass_withLong_withJavaUtilConcurrentTimeUnit_(id<JavaUtilConcurrentFuture> future, IOSClass *exceptionClass, jlong timeout, JavaUtilConcurrentTimeUnit *unit);

FOUNDATION_EXPORT id ComGoogleCommonUtilConcurrentFutures_getUncheckedWithJavaUtilConcurrentFuture_(id<JavaUtilConcurrentFuture> future);

J2OBJC_TYPE_LITERAL_HEADER(ComGoogleCommonUtilConcurrentFutures)

#endif

#if !defined (ComGoogleCommonUtilConcurrentFutures_FutureCombiner_) && (INCLUDE_ALL_ComGoogleCommonUtilConcurrentFutures || defined(INCLUDE_ComGoogleCommonUtilConcurrentFutures_FutureCombiner))
#define ComGoogleCommonUtilConcurrentFutures_FutureCombiner_

@protocol ComGoogleCommonUtilConcurrentAsyncCallable;
@protocol ComGoogleCommonUtilConcurrentListenableFuture;
@protocol JavaLangRunnable;
@protocol JavaUtilConcurrentCallable;
@protocol JavaUtilConcurrentExecutor;

/*!
 @brief A helper to create a new <code>ListenableFuture</code> whose result is generated from a combination
  of input futures.
 <p>See <code>whenAllComplete</code> and <code>whenAllSucceed</code> for how to instantiate this class. 
 <p>Example:
  
 @code
 final ListenableFuture<Instant> loginDateFuture =
      loginService.findLastLoginDate(username);
  final ListenableFuture<List<String>> recentCommandsFuture =
      recentCommandsService.findRecentCommands(username);
  Callable<UsageHistory> usageComputation =
      new Callable<UsageHistory>() {
        public UsageHistory call() throws Exception {
          return new UsageHistory(
              username, loginDateFuture.get(), recentCommandsFuture.get());
        }
      };
  ListenableFuture<UsageHistory> usageFuture =
      Futures.whenAllSucceed(loginDateFuture, recentCommandsFuture)
          .call(usageComputation, executor); 
 
@endcode
 @since 20.0
 */
@interface ComGoogleCommonUtilConcurrentFutures_FutureCombiner : NSObject

#pragma mark Public

/*!
 @brief Like <code>Executor)</code> but using executor
 .
 */
- (id<ComGoogleCommonUtilConcurrentListenableFuture>)callWithJavaUtilConcurrentCallable:(id<JavaUtilConcurrentCallable>)combiner __attribute__((deprecated));

/*!
 @brief Creates the <code>ListenableFuture</code> which will return the result of calling <code>Callable.call</code>
  in <code>combiner</code> when all futures complete, using the specified <code>executor</code>
 .
 <p>If the combiner throws a <code>CancellationException</code>, the returned future will be
  cancelled. 
 <p>If the combiner throws an <code>ExecutionException</code>, the cause of the thrown <code>ExecutionException</code>
  will be extracted and returned as the cause of the new <code>ExecutionException</code>
  that gets thrown by the returned combined future. 
 <p>Canceling this future will attempt to cancel all the component futures.
 */
- (id<ComGoogleCommonUtilConcurrentListenableFuture>)callWithJavaUtilConcurrentCallable:(id<JavaUtilConcurrentCallable>)combiner
                                                         withJavaUtilConcurrentExecutor:(id<JavaUtilConcurrentExecutor>)executor;

/*!
 @brief Like <code>Executor)</code> but using executor
 .
 */
- (id<ComGoogleCommonUtilConcurrentListenableFuture>)callAsyncWithComGoogleCommonUtilConcurrentAsyncCallable:(id<ComGoogleCommonUtilConcurrentAsyncCallable>)combiner __attribute__((deprecated));

/*!
 @brief Creates the <code>ListenableFuture</code> which will return the result of calling <code>AsyncCallable.call</code>
  in <code>combiner</code> when all futures complete, using the specified <code>executor</code>
 .
 <p>If the combiner throws a <code>CancellationException</code>, the returned future will be
  cancelled. 
 <p>If the combiner throws an <code>ExecutionException</code>, the cause of the thrown <code>ExecutionException</code>
  will be extracted and returned as the cause of the new <code>ExecutionException</code>
  that gets thrown by the returned combined future. 
 <p>Canceling this future will attempt to cancel all the component futures.
 */
- (id<ComGoogleCommonUtilConcurrentListenableFuture>)callAsyncWithComGoogleCommonUtilConcurrentAsyncCallable:(id<ComGoogleCommonUtilConcurrentAsyncCallable>)combiner
                                                                              withJavaUtilConcurrentExecutor:(id<JavaUtilConcurrentExecutor>)executor;

/*!
 @brief Creates the <code>ListenableFuture</code> which will return the result of running <code>combiner</code>
  when all Futures complete.
 <code>combiner</code> will run using <code>executor</code>.
  
 <p>If the combiner throws a <code>CancellationException</code>, the returned future will be
  cancelled. 
 <p>Canceling this Future will attempt to cancel all the component futures.
 @since 23.6
 */
- (id<ComGoogleCommonUtilConcurrentListenableFuture>)runWithJavaLangRunnable:(id<JavaLangRunnable>)combiner
                                              withJavaUtilConcurrentExecutor:(id<JavaUtilConcurrentExecutor>)executor;

// Disallowed inherited constructors, do not use.

- (instancetype __nonnull)init NS_UNAVAILABLE;

@end

J2OBJC_EMPTY_STATIC_INIT(ComGoogleCommonUtilConcurrentFutures_FutureCombiner)

J2OBJC_TYPE_LITERAL_HEADER(ComGoogleCommonUtilConcurrentFutures_FutureCombiner)

#endif


#if __has_feature(nullability)
#pragma clang diagnostic pop
#endif

#pragma clang diagnostic pop
#pragma pop_macro("INCLUDE_ALL_ComGoogleCommonUtilConcurrentFutures")
