src/main/java/de/digitalcollections/iiif/model/image/ImageApiProfile.java
public ImageApiProfile merge(ImageApiProfile other) {
    ImageApiProfile merged = new ImageApiProfile();
    streamNotNull(this.features).forEach(merged::addFeature);
    streamNotNull(other.features).forEach(merged::addFeature);
    streamNotNull(this.formats).forEach(merged::addFormat);
    streamNotNull(other.formats).forEach(merged::addFormat);
    streamNotNull(this.qualities).forEach(merged::addQuality);
    streamNotNull(other.qualities).forEach(merged::addQuality);
    if (this.maxWidth != null && other.maxWidth == null) {
      merged.maxWidth = this.maxWidth;
    } else if (this.maxWidth == null && other.maxWidth != null) {
      merged.maxWidth = other.maxWidth;
    } else if (this.maxWidth != null) {
      merged.maxWidth = Math.min(this.maxWidth, other.maxWidth);
    }
    if (this.maxHeight != null && other.maxHeight == null) {
      merged.maxHeight = this.maxHeight;
    } else if (this.maxHeight == null && other.maxHeight != null) {
      merged.maxHeight = other.maxHeight;
    } else if (this.maxHeight != null) {
      merged.maxHeight = Math.min(this.maxHeight, other.maxHeight);
    }
    if (this.maxArea != null && other.maxArea == null) {
      merged.maxArea = this.maxArea;
    } else if (this.maxArea == null && other.maxArea != null) {
      merged.maxArea = other.maxArea;
    } else if (this.maxArea != null) {
      merged.maxArea = Math.min(this.maxArea, other.maxArea);
    }
    return merged;
  }
public ImageApiProfile merge(ImageApiProfile other) {
    ImageApiProfile merged = new ImageApiProfile();
    streamNotNull(this.features).forEach(merged::addFeature);
    streamNotNull(other.features).forEach(merged::addFeature);
    streamNotNull(this.formats).forEach(merged::addFormat);
    streamNotNull(other.formats).forEach(merged::addFormat);
    streamNotNull(this.qualities).forEach(merged::addQuality);
    streamNotNull(other.qualities).forEach(merged::addQuality);
    if (this.maxWidth != null && other.maxWidth == null) {
      merged.maxWidth = this.maxWidth;
    } else if (this.maxWidth == null && other.maxWidth != null) {
      merged.maxWidth = other.maxWidth;
    } else if (this.maxWidth != null) {
      merged.maxWidth = Math.min(this.maxWidth, other.maxWidth);
    }
    if (this.maxHeight != null && other.maxHeight == null) {
      merged.maxHeight = this.maxHeight;
    } else if (this.maxHeight == null && other.maxHeight != null) {
      merged.maxHeight = other.maxHeight;
    } else if (this.maxHeight != null) {
      merged.maxHeight = Math.min(this.maxHeight, other.maxHeight);
    }
    if (this.maxArea != null && other.maxArea == null) {
      merged.maxArea = this.maxArea;
    } else if (this.maxArea == null && other.maxArea != null) {
      merged.maxArea = other.maxArea;
    } else if (this.maxArea != null) {
      merged.maxArea = Math.min(this.maxArea, other.maxArea);
    }
    return merged;
  }
Merge two profiles.

@param other profile to be merged
@return merged profile