分类
未分类

集合按某个对象属性值排序





List<OrderDto> orderSumDtoList = new ArrayList<>();
List<OrderDto> orderSumDtoListDesc = new ArrayList<>();
orderSumDtoListOrderDesc = orderSumDtoList.stream().sorted(Comparator.comparing(OrderSumDto::getPrice).reversed())
        .collect(Collectors.toList());