static final class TArray extends ArrayList {
Class type;
*() {}
*(Class *type) {}
TArray cast() { ret (TArray) this; }
public bool add(A a) {
assertIsInstance(type, a);
ret super.add(a);
}
public A set(int i, A a) {
assertIsInstance(type, a);
ret super.set(i, a);
}
// overwrite more methods?
}