大家好,我有3个表(类型,作者,仓库)的SQL数据库,它们与ID相关联,我想按表的字母顺序对作者进行排序。我写了些东西,但没用
public List<String> authorAlphabeticReference() {
Warehouse w1 = new Warehouse();
Collections.sort(warehouses,new TypeComparator());
List<String> w2 = new ArrayList<String>();
for(int i=0; i <warehouses.size(); i++) {
w1 = warehouses.get(i);
if(w1.getAuthor().equals(w2))
w2.add(w1);
}
Collections.sort(w2);
return w2;