code: public static String messagesToString(final Set<String> messages) {
      final SafeHtmlBuilder sb = new SafeHtmlBuilder();
      for (final String message : messages) {
        sb.appendEscaped(message);
        sb.appendEscaped("\n");
      }
      return sb.toSafeHtml().asString();
    }
docs: build a linefeed separated String with all messages out of given set.
  
  @param messages set of message strings
  @return String with messages