Consider this code
val map = new HashMap[(String, String), Set[(String, Int, Double, Int)]]
with MultiMap[(String, String), (String, Int, Double, Int)]
Is there a way to use the Multimap trait without repeating the type parameters definition?
You can use a type alias to cut down on repetition
Then your map becomes
However, as a stylistic rule I don’t find it a good idea to use the TupleN traits so much in code for a few reasons:
Considering that the overhead of creating a bespoke class is as little as:
it’s usually worth it!