Results 1 to 3 of 3
- 02-23-2012, 10:15 PM #1
Member
- Join Date
- Feb 2012
- Posts
- 3
- Rep Power
- 0
VERY new to Java, need help with linked lists?
Hoping someone can help me. I'm completely lost when it comes to linked lists. Not the idealogy behind it I understand that (the head is the front of the list, tail is the end, every object in the list has 2 portions one with the data and one with a link pointing to the next object in the list, yada yada). I'm actually having problems implementing it. I have searched online and can't find code I can run, only bits and pieces. Ultimately I want to get some code I can copy and paste into a complier and have it run. From there I tweak things to find out what this and that does and 9/10 I'm able to get my specific requirements met by changing the code. Can someone point me to a tutorial that has code I can just plug into a complier? Or maybe post something here? I actually have to read from a csv file into a linked list. I'd be fine just seeing how to setup a linked list reading from predefined values or user input and then figuring out from there how to go about importing the csv from there. Again, right now I just need help with the syntax, I literally have no idea how to even start setting the code up.
Thanks in advance for any assistance you're able to give.
seven
- 02-23-2012, 10:35 PM #2
Re: VERY new to Java, need help with linked lists?
A linked list would use nodes that contain a reference to the next node in the list.
To chain two nodes together, you set the value of one node's reference to point to the other node.
Create a Node class with a member that is a Node variable: nextNode.
Create an instance of that class and save its reference in a variable: node1.
Create another instance of that class and save its reference in a variable: node2
Set the Node member in the first class to the reference to the second instance: node1.nextNode = node2
You now have a linked list with two nodes.
- 02-29-2012, 02:56 AM #3
Member
- Join Date
- Feb 2012
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Copy or Clone java Linked Lists
By koko99 in forum AWT / SwingReplies: 1Last Post: 04-28-2011, 03:07 AM -
Linked Lists
By Dee in forum New To JavaReplies: 18Last Post: 02-02-2011, 03:14 AM -
Linked Lists Queue
By bdario1 in forum New To JavaReplies: 0Last Post: 04-28-2010, 04:40 AM -
Linked Lists
By vendetta in forum New To JavaReplies: 6Last Post: 01-26-2010, 08:23 AM -
question about linked lists
By jkurth in forum Advanced JavaReplies: 1Last Post: 11-11-2007, 08:33 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks