当前位置:网站首页>lambda表达式对list对象进行多字段排序
lambda表达式对list对象进行多字段排序
2022-07-24 05:48:00 【[email protected]】
1、上代码
//根据年号和号码进行正序联合排序
//年号升序
Comparator<ReplyInfoVo> year = Comparator.comparing(ReplyInfoVo::getCaseNo3);
//号码升序
Comparator<ReplyInfoVo> num = Comparator.comparing(ReplyInfoVo::getCaseNo4);
// 联合排序
Comparator<ReplyInfoVo> finalComparator = year.thenComparing(num);
replyInfoVoArrayList = replyInfoVoArrayList.stream().sorted(finalComparator).collect(Collectors.toList());
可实现先按年的字段正序排列,再按号码正序排列,亲试可行。
2、详细讲解
版权声明
本文为[[email protected]微胖子]所创,转载请带上原文链接,感谢
https://blog.csdn.net/zouyang920/article/details/125929916
边栏推荐
- MySQL gets the self incrementing line mark (different from MySQL version)
- 这10种定时任务学会了,直接飘
- [small object velocimeter] only principle, no code
- Redis特殊数据类型-BitMap
- 【LVGL】组件的样式的设置、更改、删除API函数
- Detailed explanation of class loader and parental delegation mechanism
- [lvgl (1)] a brief introduction to lvgl
- 今天聊赖数据库MySQL底层架构设计,你了解多少?
- 极客星球丨 字节跳动一站式数据治理解决方案及平台架构
- Redis.conf details
猜你喜欢

Mac解决 Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)问题

kubernetes 的Deployment(部署),Service概念,动态扩缩容

(static, dynamic, file) three versions of address book

三级分类/菜单的查询——树形结构
![[lvgl (1)] a brief introduction to lvgl](/img/2e/2e155f1d3669c27ad1b090ca954224.png)
[lvgl (1)] a brief introduction to lvgl

SparkSQL核心使用,220724,
![[media controller] open source project learning notes (based on Arduino micro development board)](/img/08/39ed97437f235806c6d4415f53c47b.png)
[media controller] open source project learning notes (based on Arduino micro development board)

Today, let's talk about the underlying architecture design of MySQL database. How much do you know?
![[audio decoding chip] Application of vs1503 audio decoding chip](/img/ee/0d5f95fba647592cc95f1e9f410bc9.png)
[audio decoding chip] Application of vs1503 audio decoding chip
![[lvgl (4)] event and event bubble of the object](/img/1e/9fe3d34f5f8d8c7298a106dca8d949.png)
[lvgl (4)] event and event bubble of the object
随机推荐
Special effects - when the mouse moves, there will be a custom expression trail
[lvgl (1)] a brief introduction to lvgl
It's not too much to fight a landlord in idea!
Depth first search (template use)
[small object velocimeter] only principle, no code
[lvgl (important)] style attribute API function and its parameters
基于回归分析的广告投入销售额预测——K邻近,决策树,随机森林,线性回归,岭回归
Special effects - return to the top (kitten effects)
(静态,动态,文件)三个版本的通讯录
Esp32 ultra detailed learning record: NTP synchronization time
【波形/信号发生器】基于 STC1524K32S4 for C on Keil
The character that appears the most times in the JS output string
【学习笔记】网页出现白屏可能的原因与优化方法
类的加载器 和 双亲委派机制详解
[lvgl (2)]
10分钟就能写出来的——25~30K的国外企业招聘面试考题,这不是轻轻松松吗~
Talk about browser cache again
These 10 kinds of timed tasks have been learned, and you can float directly
【LVGL(重要)】样式属性API函数及其参数
Learn more about when to use MySQL two locks (table lock and row lock)