code: public static Promise when(Object... d) {
      int l = d.length;
      Promise[] p = new Promise[l];
      for (int i = 0; i < l; i++) {
        p[i] = makePromise(d[i]);
      }
      return when(p);
    }
docs: Provides a way to execute callback functions based on one or more objects,
  usually Deferred objects that represent asynchronous events.
  
  Returns the Promise from a new "master" Deferred object that tracks the aggregate
  state of all the Deferreds passed. The method will resolve its master
  Deferred as soon as all the Deferreds resolve, or reject the master Deferred as
  soon as one of the Deferreds is rejected