stream().map编译报错

no instance(s) of type variable(s) R exist so that void conforms to R

<R> Stream<R> map(Function<? super T, ? extends R> mapper);
根据源码来看,map()必须有返回值

解决方法也很简单,给pojo加上chain
@Accessors(chain = true)

posted @ 2023-01-15 14:15  小万2333  阅读(987)  评论(0)    收藏  举报