persistable sclass AutoCreateList extends RandomAccessAbstractList {
new L list;
IF1 createElement; // optional, takes index and produces element
*(IF1 *createElement) {}
*(IF0 createElement) { this(if0ToIF1(createElement)); }
*(Class extends A> elementClass) { this(classToIF0(elementClass)); }
public int size() { ret list.size(); }
public A get(int i) {
while (i >= size())
list.add(createElement?.get(i));
ret list.get(i);
}
public A set(int i, A a) {
ret list.set(i, a);
};
public bool add(A a) { ret list.add(a); }
}