//companys 是一个List对象集合
Collections.sort(companys, new Comparator() {public int compare(Object a, Object b) {Long one = ((UserCompany) a).getCompany().getComid();Long two = ((UserCompany) b).getCompany().getComid();return (int) (one - two);}});