组合排序list

LiveRoomResponse 是一个对象 都懂的


// 需要组合排序list

List<LiveRoomResponse> collect = list(XXXX);

// 状态正序
Comparator<LiveRoomResponse> byLiveStatus = Comparator.comparing(LiveRoomResponse::getLiveStatus);
// 时间倒序
Comparator<LiveRoomResponse> byStartTime = Comparator.comparing(LiveRoomResponse::getStartTime).reversed();

//先状态后时间排序

collect.sort(byLiveStatus.thenComparing(byStartTime));

 

 

posted on 2021-07-12 18:02  Jun-Wang  阅读(36)  评论(0)    收藏  举报

导航