For a lister class that I have to make, which is basically just a list with some extra methods I have to have an intersection method. I think what I have below works but at the part that I labeled problem line I keep getting a "value :: is not a member of type parameter S" error. What would be causing this? Second part is just bonus but if anyone could say why what I labeled problem line two keeps saying ambiguous refrence to overloaded definition that would be great. There are two constructors, one which takes one element and starts the list, which is public, and a private main constructor that can take a list of type s and make a lister.
def intersec(other:List[S]) = {
val a=this.toList
val b=other.toList
var holder = List()
var counter=b.length
if (b.length<a.length)cycles=a.length
for (i<-0 to cycles){
if (a.contains(b(i))){
holder=holder::b(i) // problem line
}
new Lister(holder) // problem line 2
}}