In Scala, is there a way to take convert two lists into a Map? -
I have two lists, one list [a] and list [B] ] . What I need is map [A, B] , but if I need the terminology of zip then it started:
var tuplesOfAB = ListOfA zip listoff B Now I'm not sure how a map from my tuplesOfAB to
a follow up As a question, I also want to overturn my map so that I map [B, A] with a map [A, B] .
2.8 Has anyone left me? What should be the type of result of the compiler to actually use CanBuildFrom functionality and using a type directive with the breakout :
will also do the following:
val n: map [A, B] = ( List a zip list B) (breakout) and (as predicted, below, as mentioned) toMap
val O = (listA zip listB) .toMap has been added to the library as You can:
val r = m.map (_ swap) (breakout): map [b, a]
Comments
Post a Comment