class MessageList implements Serializable, Iterable<Message> {

    public MessageList getMessagesByMarker(@CheckForNull ValidationMarker marker) {
        return messages.stream()
                .filter(m -> (marker == null && !m.hasMarkers()) || marker != null && m.hasMarker(marker))
                .collect(toMessageList());
    }

    public  MessageList(@NonNull Message... messages);

}