I have a Vector
, each cell is containing a Data Structure
:
public class objet_poid_n {
public int Num;
public double Poid;
}
The problem is that the Vector may have duplications and i need to create a function or procedure able to delete duplicates .. I tried this one and it couldn't help ..
public static void removeDuplicates(Vector v)
{
for(int i=0;i<v.size();i++){
for(int j=0;j<v.size();j++)
{
if(i!=j)
{
if(v.elementAt(i).equals(v.elementAt(j)))
{
v.removeElementAt(j);
}
}
}
}
}
Any Ideas ?