阅读背景:

选择最优仓库多条件排序算法

来源:互联网 
Collections.sort(cashList, new Comparator<CompareHousePo>() {
    @Override
    public int compare(CompareHousePo o1, CompareHousePo o2) {
        int ca = 0;
        //按照境内预估费用排序
        int a = o1.getCashDeerFee().intValue() - o2.getCashDeerFee().intValue();
        if (a != 0) {
            ca = (a > 0) ? 3 : -1;
        }else {
            //按照10天到运送到仓库包裹数量
            a = o1.getBaggageNum1() - o2.getBaggageNum1();
            if (a != 0) {
                ca = (a > 0) ? 2 : -2;
            }else {
                //按照30天到运送到仓库包裹数量
                a = o1.getBaggageNum2() - o2.getBaggageNum2();
                if (a != 0) {
                    ca = (a > 0) ? 1 : -3;
                }
            }
        }
        return  ca;
    }
});
Collections.sort(cashList, new Comparator<C



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: