开发小技巧
编程小技巧
1. 将List<Object> 转换为 List<String>
List<User> userList;// [{"name":"wang","age":23},{"name":"liu","age":13}]
List<String> nameList=userList.stream()
.map(t->t.getName())
.collect(Collectors.toList());// ["wang","li"]
2. 将List转换为Map
Map<Long,user> userInfo=user.stream()
.collect(Collectors.toMap(user::getId,Function.identity()));
3. Java将JSON对象或JSON数组转list对象
https://blog.csdn.net/superPojo/article/details/108793355
4.lambda 遍历List<String>替换成另外一个值
estateMaps.stream().map(e-> domainChange(e)).collect(Collectors.toList())
5.Java对象类型集合单独取出对象中一个属性成为集合或数组
List<String> stateNameList = dictEntityList.stream().map(DictEntity::getName).collect(Collectors.toList());
pg序列自动生成 bigserial
@EnumValue
https://baomidou.com/pages/8390a4/
单元测试
- jacoco插件配置生成单元测试覆盖率报告:https://blog.csdn.net/weixin_38384296/article/details/122655287
PG删库提示“There are 2 other sessions using the database”信息
select pg_terminate_backend(pid) from (select pid from pg_stat_activity where datname = '数据库名' ) a;
- 删库
本文来自博客园,作者:帅气的涛啊,转载请注明原文链接:https://www.cnblogs.com/handsometaoa/p/16832423.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)