package com.tqnsyh.liutong;
public class lb {
private int size;//链表大小
private Node head;//头链表
public lb(){
size=0;
head=null;
}
private class Node{
private Object data=null;
private Node next=null;
public Node(Object data){
this.data=data;
}
}
public void add(Object node){
Node p=new Node(node);
if(head==null){
head=p;//将这个指针指向头结点
size++;
}else{
p.next=head;
head=p;
size++;
}
}
public int getSize(){
return this.size;
}
public Object get(int index){
Node node=head;
//从头节点开始,依次向后查找
for(int i=0;i<index;i++)
node=node.next;
return node.data;
}
public void delte(int index){
Node node=head;
if(index==0)
head=node.next;
else{
for(int i=0;i<index-1;i++)