I am trying to add to a new list the components that are not repeated from the original list. I have made this code but it does not work. If someone can help me ...
public static <E> IndexedList<E> deleteRepeated(IndexedList<E> l)
{
IndexedList<E> list = new ArrayIndexedList<E>();
for(int i=0;i<=l.size();i++)
{
for(int j=0;j<list.size();j++)
{
if(list.get(i).equals(l.get(j)))
{
list.removeElementAt(i);
j=0;
}
}
}
return list;
}