code: public static CompletionStage<Void> allOf(CompletionStage<Void> first, CompletionStage<Void> second) {
        if (!isCompletedSuccessfully(first)) {
           if (isCompletedSuccessfully(second)) {
              return first;
           } else {
              return CompletionStages.aggregateCompletionStage().dependsOn(first).dependsOn(second).freeze();
           }
        }
        return second;
     }
docs: Returns a CompletableStage that completes when both of the provides CompletionStages complete. This method
  may choose to return either of the argument if the other is complete or a new instance completely.
  @param first the first CompletionStage
  @param second the second CompletionStage
  @return a CompletionStage that is complete when both of the given CompletionStages complete