This commit is contained in:
orange 2016-12-27 18:02:06 +01:00
parent 3351bce3ef
commit b1e26cc5da

View File

@ -0,0 +1,35 @@
public class ListNI extends SimpleList{
public ListNI(){
super();
}
public void addAt(int pos, Object elem){
if(pos==0)
addHead(elem);
else if(!isEmpty()){
Object headElem=head();
remHead();
addAt(pos-1, elem);
addHead(headElem);
}
}
public void remAt(int pos, Object elem){
if(pos==0)
remHead();
else if(!isEmpty()){
Object headElem=head();
remHead();
remAt(pos-1, elem);
addHead(headElem);
}
}
public ListNI copy(){
ListNI list = new ListNI();
list.node=this.node;
list.len=this.len;
return list;
}
}