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按对象属性排序
最新推荐文章于 2023-02-22 15:44:36 发布