![]() |
SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
![]() |
#1 |
Captain
![]() Join Date: Jan 2002
Location: Sweden
Posts: 493
Downloads: 15
Uploads: 0
|
![]()
If so, you might be able to help out a bit. I'm trying to remove the last node from a linked list, and it works alright until I only have one node remaining in the list. That's were all goes wrong. This is the code I have for the GetLast() - method:
Code:
public LNode<T> GetLast() { if (head == null) { return null; } else { LNode<T> current = head; while (current.Next != null) { current = current.Next; } LNode<T> toGet = current; current.Previous.Next = null; return toGet; } } ![]() ![]()
__________________
And God said: \"Let there be Narrowband!\" |
![]() |
![]() |
![]() |
#2 |
Captain
![]() Join Date: Jan 2002
Location: Sweden
Posts: 493
Downloads: 15
Uploads: 0
|
![]()
Never mind, I read my post twice and managed to find a solution.
![]()
__________________
And God said: \"Let there be Narrowband!\" |
![]() |
![]() |
![]() |
|
|