我将为您翻译中文,以下是需要翻译的内容:
我想知道flatmapping的两种情况之间是否有明显的区别。
情况1:
someCollection
.stream()
.map(CollectionElement::getAnotherCollection)
.flatMap(Collection::stream);
案例2:
someCollection
.stream()
.flatMap(element -> element.getAnotherCollection().stream());
哪个更好?在性能方面哪一个更优秀?