code: public static <T> IPromise<T> race( Collection<IPromise<T>> futures ) {
          Promise p = new Promise();
          AtomicBoolean fin = new AtomicBoolean(false);
          for (Iterator<IPromise<T>> iterator = futures.iterator(); iterator.hasNext(); ) {
              iterator.next().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