protected void setInputInUiThread (List<List> forms) {
if (sort) {
List<List> sorted = new ArrayList(forms);
Collections.sort(sorted, new Comparator<List> () {
public int compare(List o1, List o2) {
Symbol s1 = symbol(RT.first(o1)),
s2 = symbol(RT.first(o2));
if (s1 == null && s2 == null) return 0; // mandatory for Comparator contract
if (s1 == null) return 1;
if (s2 == null) return -1;
if (s1.getName().equals("ns") && s2.getName().equals("ns")) {
// fall through to order ns decls correctly
} else {
if (s1.getName().equals("ns")) return -1;
if (s2.getName().equals("ns")) return 1;
}
if (isPrivate(o1) != isPrivate(o2)) {
return isPrivate(o1) ? -1 : 1;
}
s1 = symbol(RT.second(o1));
s2 = symbol(RT.second(o2));
if (s1 == null && s2 == null) return 0; // mandatory for Comparator contract
if (s1 == null) return 1;
if (s2 == null) return -1;
return s1.getName().compareToIgnoreCase(s2.getName());
}
});
forms = sorted;
}
final List<List> theForms = forms;