this code is just a test to find duplicates of a vector and remove them ,while removing the correspoding objects of 2 other vectors
This gives as output an Arrayoutofindex in line 3.Do you have any suggestions?
for (int k = 0 ; k < vA.size() ; k++)
{
Object a = vA.elementAt(0);
Object b = vA.elementAt(k);
if(a == b && k!=0)
{
int duplicate = vA.indexOf(b);
vA.removeElementAt(duplicate);
vB.removeElementAt(duplicate);
vC.removeElementAt(duplicate);
}
for (int k = 0 ; k <= vA.size() ; k++)k should run only from
0tova.size() - 1because it is zero-based, i.e. the first index is0. Rewrite the loop statement as:for (int k = 0 ; k < vA.size() ; k++)