3 ways to flatten a list of lists. Is there a reason to prefer one of them?

前端 未结 3 1140
孤独总比滥情好
孤独总比滥情好 2021-02-07 04:18

Assume we have a list as follows. CoreResult has a field of type List.

final List list = new LinkedList         


        
3条回答
  •  别跟我提以往
    2021-02-07 04:48

    Option 3 and 2 is same, so up to you if you want to map first and then flat map or just flatmap.

    With option 1 you have to open another stream to perform further operations.

提交回复
热议问题