[Solved] call method between two objects SCALA


The problem is that the value you are attempting to assign to list1 is a Set, but the list1 var is of type List.

The compiler error explains this as best it can, but perhaps the error message is a bit obscure because the right hand side of the assignment could take many types (“polymorphic expression”), so the “found” line in the error message is a range of types, rather than a single type.

Try either changing list1 to be of type Set[String] or changing the toSet call to a toList call.

solved call method between two objects SCALA