}
});
} else if (sort.equals("collection")) {
Arrays.sort(contents.toArray(), new Comparator() {
public int compare(Object o1, Object o2) {
TraversableSource ts1 = (TraversableSource) o1;
TraversableSource ts2 = (TraversableSource) o2;
if (reverse) {
if (ts2.isCollection() && !ts1.isCollection())
return -1;
if (!ts2.isCollection() && ts1.isCollection())
return 1;
return ts2.getName().compareTo(ts1.getName());
}
if (ts2.isCollection() && !ts1.isCollection())
return 1;
if (!ts2.isCollection() && ts1.isCollection())
return -1;
return ts1.getName().compareTo(ts2.getName());
}
});
}
for (int i = 0; i < contents.size(); i++) {