code: private boolean resolveAllRenditions(Media media, Asset asset, MediaArgs mediaArgs) {
      boolean allMandatory = mediaArgs.isMediaFormatsMandatory();
      boolean allResolved = true;
      boolean anyResolved = false;
      List<Rendition> resolvedRenditions = new ArrayList<>();
      for (MediaFormat mediaFormat : mediaArgs.getMediaFormats()) {
        MediaArgs renditionMediaArgs = mediaArgs.clone();
        renditionMediaArgs.mediaFormat(mediaFormat);
        renditionMediaArgs.mediaFormatsMandatory(false);
        Rendition rendition = asset.getRendition(renditionMediaArgs);
        if (rendition != null) {
          resolvedRenditions.add(rendition);
          anyResolved = true;
        }
        else {
          allResolved = false;
        }
      }
      media.setRenditions(resolvedRenditions);
      if (!resolvedRenditions.isEmpty()) {
        media.setUrl(resolvedRenditions.get(0).getUrl());
      }
      if (allMandatory) {
        return allResolved;
      }
      else {
        return anyResolved;
      }
    }
docs: Iterates over all defined media format and tries to find a matching rendition for each of them
  in combination with the other media args.
  @param media Media
  @param asset Asset
  @param mediaArgs Media args
  @return true if for all mandatory or for at least one media formats a rendition could be found.