Can you collect(joining()) without mapping to string?

懵懂的女人 提交于 2019-12-01 09:39:22
Eugene

Whatever the book says is wrong and your interpretation is right (unless the point is entirely different and you did not get it)

people.stream()

will generate a Stream<People>, while Collectors.joining has a definition of:

public static Collector<CharSequence, ?, String> joining()

obviously this can't work as Person is not an instance of CharSequence.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!