more isEmpty and a static

This commit is contained in:
zzz
2010-05-05 18:43:33 +00:00
parent 8225ce063a
commit 0325f6c4d2

View File

@ -85,16 +85,16 @@ public class FormHandler {
public String getAllMessages() { public String getAllMessages() {
validate(); validate();
process(); process();
if (_errors.size() <= 0 && _notices.size() <= 0) if (_errors.isEmpty() && _notices.isEmpty())
return ""; return "";
StringBuilder buf = new StringBuilder(512); StringBuilder buf = new StringBuilder(512);
buf.append("<div class=\"messages\" id=\"messages\"><p>"); buf.append("<div class=\"messages\" id=\"messages\"><p>");
if (_errors.size() > 0) { if (!_errors.isEmpty()) {
buf.append("<span class=\"error\">"); buf.append("<span class=\"error\">");
buf.append(render(_errors)); buf.append(render(_errors));
buf.append("</span>"); buf.append("</span>");
} }
if (_notices.size() > 0) { if (!_notices.isEmpty()) {
buf.append("<span class=\"notice\">"); buf.append("<span class=\"notice\">");
buf.append(render(_notices)); buf.append(render(_notices));
buf.append("</span>"); buf.append("</span>");
@ -174,8 +174,8 @@ public class FormHandler {
} }
} }
private String render(List<String> source) { private static String render(List<String> source) {
if (source.size() <= 0) { if (source.isEmpty()) {
return ""; return "";
} else { } else {
StringBuilder buf = new StringBuilder(512); StringBuilder buf = new StringBuilder(512);