/*** 節點類
* @author jp
* */
class node
}/**
* 連結串列類
* @author jp
* */
public class mylinkedlist
/*** 增加操作
* @param value
*/public void add(object value) else
cur.next = end;
end.pre = cur;
size++;
} /**
* 在指定位置插入元素,第一個元素的下標為0
* @param index
* @param value
* @throws exception
*/public void add(int index, object value) throws exception else
size++;
} /**
* 刪除指定位置的元素,第一個元素的下標為0
* @param index
* @throws exception
*/public void remove(int index) throws exception
/*** 獲取指定位置的節點元素
* @param index
* @return
* @throws exception
*/public node get(int index) throws exception
node node = head.next;
for (int i = 1; i <= index; i++)
return node;
} /**
* 將連結串列轉化成陣列
* @return
*/public object toarray()
return arr;
} public static void main(string args) throws exception
}}