package linkList.kcsj;public class BorthWay<AnyType> {
Node<AnyType> firstNode;
int theSize;
//建立空表
/* public BorthWay(){
firstNode.next=firstNode.pre=firstNode;
    theSize=0;
}*/
 
 //返回表的大小
 int size(){
 return theSize;
 }
 //得到第id个节点
 public Node<AnyType> get(int id){
 Node<AnyType> p;
p=firstNode;
int j;
if(theSize==0){
return null;
}
else if(id<=theSize){
for(j=0;j<id-1;j++){
p=p.next;
}
}
else
System.out.println("越界");
return p;
 }
//插入第i个节点
public void add(int id,AnyType insert){
if(theSize==0){
firstNode=new Node<AnyType>(insert,null,null);
theSize++;
}
else{

Node<AnyType> getNode=get(id);
    System.out.print(getNode);
Node<AnyType> newNode=new Node<AnyType>(insert,getNode.pre,getNode);
getNode.pre=newNode;
getNode.next=null;
theSize++;
}
}
public void addFirst(AnyType insert ){
add(0,insert);
}//输出链表
void print(){
Node p=firstNode;
while(p!=null){
System.out.print(p.data+" ");
p=p.next;
}
}
public static void main(String[] args){
BorthWay<Integer> btw=new BorthWay<Integer>();
    int[] a={1,2,3,4,5,6,};
    for(int i=0;i<6;i++){
btw.add(i,a[i]);
    }
btw.addFirst(3);
btw.print();

}
}
哪位大侠帮忙看看,哪里的错误额