List按某個字段排序

List<BizRecordDetailDO> bizRecordDetailDOs = bizRecordDetailDao.getBizRecordDetailByBizId(bizId);
Collections.sort(bizRecordDetailDOs, new Comparator<BizRecordDetailDO>(){   
            public int compare(BizRecordDetailDO bizRecord1, BizRecordDetailDO bizRecord2) {   
                //按照callDirection進行升序排列   
                if(bizRecord1.getCallDirection() > bizRecord2.getCallDirection()){   
                    return 1;   
                }   
                if(bizRecord1.getCallDirection() > bizRecord2.getCallDirection()){   
                    return 0;   
               }   
               return -1;   
            }   
        });    
return bizRecordDetailDOs;
相關文章
相關標籤/搜索