code: public static <T> IPromise<T> race( IPromise<T>... futures ) {
          Promise p = new Promise();
          AtomicBoolean fin = new AtomicBoolean(false);
          for (int i = 0; i < futures.length; i++) {
              futures[i].then( (r,e) -> {
                  if ( fin.compareAndSet(false,true) ) {
                      p.complete(r, e);
                  }
              });
          }
          return p;
      }
docs: similar to es6 Promise.race method, however non-IPromise objects are not allowed
  
  returns a future which is settled once one of the futures provided gets settled