比如我要取 实体列表中的id字段;方法有很多,比如for循环,但是代码量比较多;简单的方法就是利用 stream()流处理;
栗子:
List<Entity> list= 你的接口;
List<Long> collect =list.stream ().map(Entity::getId).collect (Collectors.toList ());
这样,你就得到了id串了。
比如我要取 实体列表中的id字段;方法有很多,比如for循环,但是代码量比较多;简单的方法就是利用 stream()流处理;
栗子:
List<Entity> list= 你的接口;
List<Long> collect =list.stream ().map(Entity::getId).collect (Collectors.toList ());
这样,你就得到了id串了。