private RenditionMetadata getOriginalOrFirstRendition ( Set < RenditionMetadata > candidates ) { if ( this . originalRendition != null && candidates . contains ( this . originalRendition ) ) { return this . originalRendition ; } else if ( ! candidates . isEmpty ( ) ) { return candidates . iterator ( ) . next ( ) ; } else { return null ; } }
Returns original rendition - if it is contained in the candidate set . Otherwise first candidate is returned . If a VirtualCropRenditionMetadata is present always the first one is returned .