public static int getSize(Hero head){
if (head.getNext() == null){
System.out.println("链表为空!!!");
return 0;
}
Hero temp = head.getNext();
int sum = 0;
while (temp != null){
sum ++;
temp = temp.getNext();
}
return sum;
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-2303.html