List<GoodsPrice> prices = goods.getPrices();
// 将价格排序
Collections.sort(prices, new Comparator<GoodsPrice>() {
public int compare(GoodsPrice o1, GoodsPrice o2) {
return o2.getPrice().compareTo(o1.getPrice());
}
});
java按对象属性排序
最新推荐文章于 2024-07-29 18:45:16 发布