functional programming - scala gather a list of pair combination -
functional programming - scala gather a list of pair combination -
given following:
map( x -> list( (option[ob1], option[obja]), (option[obj1], option[objb]), (option[obj2], option[obja]), (option[obj2], option[objb]), (..., ...) ))    i need collect , grouping combinations pair of 2 lists (while keeping map , key portion same now):
map (x -> ( list(obj1, obj2, obj3 ...), list(obja, objb ...) )    so in other words, need perform sort of opposite operation of creating combinations of 2 lists , need "original" 2 lists containing each unique element. have tried various combinations of unzip , mapping no success.
sounds you're looking map:
.mapvalues(_.unzip).mapvalues{ case (a, b) => (a.distinct, b.distinct) }    if need sorting, can chain against distinct methods.
 scala functional-programming 
 
Comments
Post a Comment