I have a method like this where I\'m using recursion with Streams:
private static List convertToFlatList(List memberList)
{
The recursion will end when memberList
will be empty, since at this case an empty List
will be returned.
i.e. when i.getChildren()
is an empty List
, the recursive call convertToFlatList(i.getChildren())
will receive an empty List
, so the Stream
pipeline won't make another recursive call (since it has no elements to execute flatMap
on), and will return an empty List
.