diff --git a/src/StruttureDati/SimpleList/ListNI.java b/src/StruttureDati/SimpleList/ListNI.java new file mode 100644 index 0000000..66ae221 --- /dev/null +++ b/src/StruttureDati/SimpleList/ListNI.java @@ -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; + } +} \ No newline at end of file