Source:
static SafeHtml formatUserList(ChangeScreen2.Style style, Collection<? extends AccountInfo> in, Set<Integer> removable) { List<AccountInfo> users = new ArrayList<AccountInfo>(in); Collections.sort(users, new Comparator<AccountInfo>() { @Override public int compare(AccountInfo a, AccountInfo b) { String as = name(a); String bs = name(b); if (as.isEmpty()) { return 1; } else if (bs.isEmpty()) { return -1; } return as.compareTo(bs); } private String name(AccountInfo a) { if (a.name() != null) { return a.name(); } else if (a.email() != null) { return a.email(); } return ""; } }); SafeHtmlBuilder html = new SafeHtmlBuilder(); Iterator<? extends AccountInfo> itr = users.iterator(); while (itr.hasNext()) { AccountInfo ai = itr.next(); AvatarInfo img = ai.avatar(AvatarInfo.DEFAULT_SIZE); String name; if (ai.name() != null) { name = ai.name(); } else if (ai.email() != null) { name = ai.email(); } else { name = Integer.toString(ai._account_id()); } html.openSpan(); html.setAttribute("role", "listitem"); html.setAttribute(DATA_ID, ai._account_id()); html.setStyleName(style.label_user()); if (img != null) { html.openElement("img"); html.setAttribute("src", img.url()); if (img.width() > 0) { html.setAttribute("width", img.width()); } if (img.height() > 0) { html.setAttribute("height", img.height()); } html.closeSelf(); } html.append(name); if (removable.contains(ai._account_id())) { html.openElement("button"); html.setAttribute("title", Util.M.removeReviewer(name)); html.setAttribute("onclick", REMOVE + "(event)"); html.append(SafeHtml.asis("&#x24cd;")); html.closeElement("button"); } html.closeSpan(); } return html; }

Target:
static SafeHtml formatUserList(ChangeScreen2.Style style, Collection<? extends AccountInfo> in, Set<Integer> removable) { List<AccountInfo> users = new ArrayList<AccountInfo>(in); Collections.sort(users, new Comparator<AccountInfo>() { @Override public int compare(AccountInfo a, AccountInfo b) { String as = name(a); String bs = name(b); if (as.isEmpty()) { return 1; } else if (bs.isEmpty()) { return -1; } return as.compareTo(bs); } private String name(AccountInfo a) { if (a.name() != null) { return a.name(); } else if (a.email() != null) { return a.email(); } return ""; } }); SafeHtmlBuilder html = new SafeHtmlBuilder(); Iterator<? extends AccountInfo> itr = users.iterator(); while (itr.hasNext()) { AccountInfo ai = itr.next(); AvatarInfo img = ai.avatar(AvatarInfo.DEFAULT_SIZE); String name; if (ai.name() != null) { name = ai.name(); } else if (ai.email() != null) { name = ai.email(); } else { name = Integer.toString(ai._account_id()); } html.openSpan(); html.setAttribute("role", "listitem"); html.setAttribute(DATA_ID, ai._account_id()); html.setStyleName(style.label_user()); if (img != null) { html.openElement("img"); html.setStyleName(style.avatar()); html.setAttribute("src", img.url()); if (img.width() > 0) { html.setAttribute("width", img.width()); } if (img.height() > 0) { html.setAttribute("height", img.height()); } html.closeSelf(); } html.append(name); if (removable.contains(ai._account_id())) { html.openElement("button"); html.setAttribute("title", Util.M.removeReviewer(name)); html.setAttribute("onclick", REMOVE + "(event)"); html.append(new ImageResourceRenderer().render(Resources.I.remove_reviewer())); } html.closeSpan(); } return html; }