21 lines
335 B
Java
Executable File
21 lines
335 B
Java
Executable File
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);
|
|
}
|
|
}
|
|
}
|