Ignore my cry for help, my problem is fixed. (I.e. don't post here)
Yeah...
Code's here.Anywho, we need to do something with Linked Lists. That part will be easy enough once I get to it, it's making this Linked List work that's giving me trouble. Namely, in the first class I posted, StoryList, we have to create two "Add" methods, one that just adds things to the end of the list, and one that takes an index allowing you to place an object in the middle of the list. The second of these methods isn't working for me, because when I run the test code in the "Program" class, it blows up. I have a feeling the way I have it linking everything together in the 2nd Add method is faulty, but I'm not sure in what way, since that's directly based on how our teacher taught us how to do LinkedLists. Any help would be appreciated.
Comments
searchNode.SetPrevious(newNode);
newNode.SetNext(searchNode);
searchNode = searchNode.GetPrevious(); //Problem lies here
newNode.SetPrevious(searchNode);
searchNode.SetNext(newNode);
I've marked where your problem lies. Try to understand why that line will mess you up. Grab a piece of paper and work out the operations by drawing and removing the connections between the new and old nodes. Follow exactly what you wrote and you will see why it is wrong.