public Optional<ValidationMessage> getHighestMessage() {
		final Optional<ValidationMessage> error = getMessages().stream()
				.filter(message -> message.getSeverity().equals(Severity.ERROR))
				.findFirst();
		
		if (error.isPresent()) {
			return error;
		} else {
			final Optional<ValidationMessage> warning = getMessages().stream()
					.filter(message -> message.getSeverity().equals(Severity.WARNING))
					.findFirst();
			
			return warning;
		}
	}
public Optional<ValidationMessage> getHighestMessage() {
		final Optional<ValidationMessage> error = getMessages().stream()
				.filter(message -> message.getSeverity().equals(Severity.ERROR))
				.findFirst();
		
		if (error.isPresent()) {
			return error;
		} else {
			final Optional<ValidationMessage> warning = getMessages().stream()
					.filter(message -> message.getSeverity().equals(Severity.WARNING))
					.findFirst();
			
			return warning;
		}
	}
public Optional < ValidationMessage > getHighestMessage ( ) { final Optional < ValidationMessage > error = getMessages ( ) . stream ( ) . filter ( message -> message . getSeverity ( ) . equals ( Severity . ERROR ) ) . findFirst ( ) ; if ( error . isPresent ( ) ) { return error ; } else { final Optional < ValidationMessage > warning = getMessages ( ) . stream ( ) . filter ( message -> message . getSeverity ( ) . equals ( Severity . WARNING ) ) . findFirst ( ) ; return warning ; } }
Returns the message with the highest priority using the following algorithm: - if there are messages with
{@link Severity#ERROR}, take the first one. - otherwise, if there are messages with {@link Severity#WARNING},
take the first one. - otherwise, an empty Optional is returned.

@return an Optional containing the ValidationMessage or an empty Optional.
Returns the message with the highest priority using the following algorithm : - if there are messages with { @link Severity#ERROR } take the first one . - otherwise if there are messages with { @link Severity#WARNING } take the first one . - otherwise an empty Optional is returned .