Java Streams: Collect a Stream to Map
From a Stream, a Map.
We already had a glimpse at the Collectors
class when we needed to turn a stream back into a list, with the Collectors.ToList()
static method here:
Powerful and easy, it returns a list of the same type as the original stream.