对象按某个属性值排序
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了对象按某个属性值排序相关的知识,希望对你有一定的参考价值。
Collections.sort(list, new Comparator<PriceTypeSkuNum>() { @Override public int compare(PriceTypeSkuNum o1, PriceTypeSkuNum o2) { if(o1.getPrice() > o2.getPrice()){ return 1; } if(o1.getPrice() == o2.getPrice()){ return 0; } return -1; } });
以上是关于对象按某个属性值排序的主要内容,如果未能解决你的问题,请参考以下文章