21 lines
335 B
Plaintext
21 lines
335 B
Plaintext
|
class List<A>{
|
||
|
List <A>next = new List();
|
||
|
A object = null;
|
||
|
A getObjectAt(int n){
|
||
|
if(n==0){
|
||
|
return object;
|
||
|
}
|
||
|
else{
|
||
|
return this.next.getObjectAt(n-1);
|
||
|
}
|
||
|
}
|
||
|
void insert(A object){
|
||
|
if(this. Object == null){
|
||
|
this.object = object;
|
||
|
}
|
||
|
else{
|
||
|
this.next.insert(object);
|
||
|
}
|
||
|
}
|
||
|
}
|