Any help is appreciated. I am unsuccessfully trying to extend an AbstractList. I have looked at Java documents regarding
AbstractList as well as the skimpy
Sun Custom Collection Tutorial, but I'm still drawing blank.
A couple of basic questions: Is my internal representation of the array a standard Array? something like myJ below? And if so, since I want to make this a variable sized collection, the docs state that I must override the add and remove methods. If my internal representation is a nonvariable sized array, how do I go about doing this? Or am I way off base to begin with?
import java.util.AbstractList;
public class JunkList extends AbstractList<Junk>
{
private final Junk[] myJ;
public JunkList()
{
myJ = new Junk[0];
}
@Override
public Junk get(int index)
{
return myJ[index];
}
@Override
public Junk set(int index, Junk ele)
{
Junk oldValue = myJ[index];
myJ[index] = ele;
return oldValue;
}
@Override
public int size()
{
return myJ.length;
}
}
Many thanks in advance!
/Pete