// FIXME public void Sort() { bool swap = true; ListNode lastSwap = tail; // empty or a single entry, just return if (head == null || head.Next == null) { return; } while (swap) { swap = false; ListNode loopEnd = lastSwap; for (ListNode curNode = head; curNode != loopEnd; curNode = curNode.Next) { ListNode nextNode = curNode.Next; // if we need to move things, swap the data if (curNode.ToString().CompareTo(nextNode.ToString()) > 0) { Object tmp = nextNode.getData(); nextNode.setData(curNode.getData()); curNode.setData(tmp); swap = true; lastSwap = nextNode; } } } }
public Object GetNext() { if (currentNode != null) { object o = currentNode.getData(); currentNode = currentNode.Next; return(o); } return(null); }