I have a very simple method in a class:
def partysCandidate(party: String): Vector[Candidate]= {
var result = Vector[Candidate]()
for (candidate <- this.candidates) {
if (candidate.party == party) result = result + candidate
}
result
}
However it gave me Error type mismatch found : package.Candidate required: String at result + candidate. I couldn't figure out why. Any help would be much appreciated.
Many thanks!