创建SLinkList并继承ILinarList
public class SLinkList<E> implements ILinarList<E> {
private Node<E> start;
int size;
private static class Node<E>{
E item;
Node<E>next;
Node(E item,Node<E>next){
this.item=item;
this.next=next;
}
}
public SLinkList(){
start=null;
}
@Override
public boolean add(E item) {
if (start == null){
start = new Node<E>(item,null);
}else {
Node<E>current=start;
while (current.next !=null){
current= current.next;
}
current.next=new Node<E>(item,null);
}
size++;
return true;
}
@Override
public boolean add(int i, E item) {
Node<E> current;
Node<E> previous;
if (i &l