1、首先对象要实现排序接口
public class SpinningStatus extends BaseEntity implements Comparable<SpinningStatus>
2、在程序中实现compareto接口
@Override public int compareTo(SpinningStatus o) { try { Long tlong=new Long(this.getSearchValue()); Long olong=new Long(o.getSearchValue()); if(tlong-olong>0){ return -1; }else if(tlong==olong){ return 0; }else{ return 1; } } catch (Exception e) { return 0; } }
3、在程序中执行
Collections.sort(list);
这样操作后就针对searchValue值进行排序了