Two .map-s one after another is code smell (and also a bit slow). Why not combine them into one?<p>Do standard collections have groupBy? You can go a long way with groupBy and zipWith operations, which are a pair like map-reduce but for in-memory handling.