草稿纸
来源:互联网 发布:比初页好用的软件 编辑:程序博客网 时间:2024/04/29 14:34
public static<AnyType> int listSize (LinkedList<AnyType> theList){
LinkedListIterator<AnyType> itr;
int size=0;
for(itr=theList.first();itr.isValid();itr.advance())
size++;
return size;
}
求长度
public class LinkedListIterator<AnyType> {
/**
* Construct the list iterator
* @param the Node any node in the linked list.
*/
LinkedListIterator(ListNode<AnyType> theNode)
{current=theNode;}
/**
* Test if the current position is a valid position is a valid position in the list.
* @return current !=null;
*/
/**
* 未完
*/
}