say we have string type array like below,
val arrayy = Array("AA","BB","CCAB","AABA")
We have to split into code that consists of just TWO characters.
Using just a flatmap function will solve your problem
a.flatMap{ _.grouped(2) }
'소프트웨어 개발 > Scala - Functional' 카테고리의 다른 글
map ++ map (0) | 2018.06.30 |
---|---|
count sum example using identity (0) | 2018.06.29 |
scala collect list scala (0) | 2018.06.29 |
스파크 전치... (0) | 2018.06.20 |
Spark Dataframe UDF - Schema for type Any is not supported (0) | 2018.06.01 |