Actually, you can have 2 loops inside the same for compression, yield Tuple2s, then toMap.