in genere le liste sono fatte ad array di Object valorizzati così
Object[] a = new Object[10];
int pos = 0;
void add(Object o) {
a[pos] = o;
pos++;
}
quindi size restituisce la dimensione
int size() {
return pos;
}
e get ritorna l'Object così
Object get(int idx) {
if (idx <= pos)
return a[idx];
else
throw new ArrayOutOfBoundsException("message");
}