目录
场景:
将List转换为某个属性作为主键的Map实体作为Map
ArrayList<User> users=new ArrayList<>();
Map<Long, User> collect = userStream.collect(Collectors.toMap(User::getId, u -> u));
标签:Map,Stream,作为,学会,List,笔记,collect,ArrayList,主键
来源: https://blog.csdn.net/m0_49194578/article/details/121265086