What is a neat way to hold pairs of strings which are not necessarily key-values (might have duplicate keys), for a small collection? List[List[String]] works obviously but looks dirty.
Cheers
Parsa
List[(String,String)]
is the standard solution:
scala> List(("foo","bar"), ("foo","baz"))
res1: List[(java.lang.String, java.lang.String)] = List((foo,bar), (foo,baz))
Tuples are the ideal data structure to represent pairs.
So use a list of (String, String)
tuples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With