我有类似这样的东西,希望能得到一个字符串作为结果。
List<Profile> profile;
String result = profile
.stream()
.filter(pro -> pro.getLastName().equals("test"))
.flatMap(pro -> pro.getCategory())
getCategory() 应该返回一个字符串,但我不确定该使用什么来返回一个字符串,我尝试了几种方法但是都没有成功
有什么想法吗?
谢谢
flatMap()
? - shmosel.collect(Collectors.joining());
... ? - Roddy of the Frozen PeasfindFirst
。 - VHS