Hi ive a question about vectors. I have two vectors each containing the same string of 8 words:
ONE TWO THREE THERE
FOUR FIVE SIX SEVEN
and i am comparing the two:
int sameWord = 0;
for(int i = 0; i < vector1.size(); i++)
{
Object a = vector1.elementAt(i);
for(int j = 0; j < vector2.size(); j++)
{
Object b = vector2.elementAt(j);
if(a.toString().compareTo(b.toString()) == 0){
sameWord++;
}
}
}
the result however when comparing the two is that 9 of these words are the same whereas i would expect it to be eight since there are only 8 words in each string and both vectors contain the same string. Does anybody know why this result would be 9?
Thanks