开发小技巧

编程小技巧

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

image

@EnumValue

https://baomidou.com/pages/8390a4/

单元测试

PG删库提示“There are 2 other sessions using the database”信息

  1. select pg_terminate_backend(pid) from (select pid from pg_stat_activity where datname = '数据库名' ) a;
  2. 删库
posted @   帅气的涛啊  阅读(21)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
点击右上角即可分享
微信分享提示

目录