I have a Foo class that extends AbstractList and implements List. This class implements some of the List methods, but some just throw UnsupportedOperationException.
toArray is one of the later and while the compiler doesn't complain about other not really implemented methods, it complains about the toArray with error:
Class must either be declared abstract or implement abstract method toArray(T[]) in List.
public class Foo extends AbstractList implementst List {
...
public <T> T[] toArray(T[] a) throws UnsupportedOperationException {
throw new UnsupportedOperationException(error);
}
}
What is wrong here and why the compiler still thinks the toArray(T[]) method is not implemented?