//在实体类中须要实现Comparable<实体类> 在实体类中实现方法 public int compareTo(ShopProduct o) { // TODO Auto-generated method stub return Integer.valueOf(o.getSales()) - Integer.valueOf(this.sales); } 在业务逻辑中的使用方法为: Collections.sort(list数组); 复制代码