I'm not as sure on this one but I think this is an errata. Sorry if I'm wrong.
Page 225 chapter 4, on the essential chapter called
Write code for common intermediate operations.
It's written:
The flatmap() method flattens nested lists into a single level and removes empty lists.
I think it should be:
The flatmap() method flattens nested streams into a single level and removes empty streams.
As the signature for flatmap is:
So the Function parameter of flatmap needs to return a stream, not a list.