scala - Operation inside tuple - Convert a nested array into flat array -
i asked question how convert array("aa", array("bb", "cc"), "dd") array("aa", "bb", "cc", "dd"), solved by
arr.flatmap { | case s: string => array(s) | case a: array[string] => | } now have data array((aa, array(bb, cc), dd)). looks array of tuple contains nested array. want output array((aa, bb, cc, dd)), couldn't figure out. please help! thanks!
you can this:
val = arr.head; array(a._1, a._2, a._3)... [the rest of code]
Comments
Post a Comment