matching vector element to string
I am writing a simple Naive Bayesian spam filter.
My problem is when trying to train the filter on a tagged corpus. I have converted the file to a vector with each element corresponding to a word and the first being a tag either spam or ham
if(tokens.firstElement() == "spam")
{
spamCount++;
tokens.removeElementAt(0);
wordCount += tokens.size();
spamMap = DataMap.learn(spamMap, tokens);
}
else if(tokens.firstElement().toString() == "ham")
{
hamCount++;
tokens.removeElementAt(0);
wordCount += tokens.size();
hamMap = DataMap.learn(hamMap, tokens);
}
else { System.out.print("\n" + tokens.firstElement()); }
}
I know that the vector elements hold the right values but the if statements are failing 100%

