In a situation similar to this
type abc=(Int,String)
val list=mutable.set[abc]()
How would I add something to the list? What does something with type (Int,String) look like?
I tried doing things similar to list+=(5,"hello")
but nothing I tried worked.
I find the existing answer distracting. It doesn't explain what the problem is, which is simply that the parenthesis are being interpreted as parameter parenthesis, not tuple parenthesis. Look here:
The first time fails because you are calling the method
+=
with two parameters, instead of calling it with one parameter that is a tuple.The second time works because I used
->
to denote the tuple.The third time works because I put the extra tuple-parenthesis to denote the tuple.
That said, calling the
Set
alist
is bad, because people would tend to think it is aList
.