So I'm writing my own simplified LinkedList class. When I compile my code I receive this error
Error: F:\Files\ICS\Card\LinkedList2.java:3: name clash: indexOf(E) in LinkedList2<E> and indexOf(java.lang.Object) in java.util.AbstractList<E> have the same erasure, yet neither overrides the other
The code is
public int indexOf (E element)
{
Link<E> o = new Link<E>();
for (int i = 0; i<size; i++)
{
o = getElement(i);
if (o.data.equals(element))
return i;
}
return -1;
}
and the LinkedList class header is
public class LinkedList2<E> extends AbstractSequentialList<E>