Scala Type Type Mismatch
I am writing methods to convert Set[Tuple2[String, String]]
to String
and vice versa.
I store the string value as v1, v2 # v3, v4 # v5, v6
To fill Set
, I split the string into ",", and in order to extract the values, I tried to split each value with "#", but I get
Mismatch Type: Found: x.type (with base type Array [String]
The code I tried to use is
val x = overwriters.split("#")
for(tuple <- x) {
tuple.split(",")
}
The return type of split is a String array, so it’s not clear to me why I cannot split each member of the returned array
+3
source to share
2 answers