Results 1 to 3 of 3
  1. #1
    seven is offline Member
    Join Date
    Feb 2012
    Posts
    3
    Rep Power
    0

    Default 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

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,874
    Rep Power
    25

    Default 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.

  3. #3
    seven is offline Member
    Join Date
    Feb 2012
    Posts
    3
    Rep Power
    0

    Default Re: VERY new to Java, need help with linked lists?

    thank you much. greatly appreciate it.

Similar Threads

  1. Copy or Clone java Linked Lists
    By koko99 in forum AWT / Swing
    Replies: 1
    Last Post: 04-28-2011, 04:07 AM
  2. Linked Lists
    By Dee in forum New To Java
    Replies: 18
    Last Post: 02-02-2011, 04:14 AM
  3. Linked Lists Queue
    By bdario1 in forum New To Java
    Replies: 0
    Last Post: 04-28-2010, 05:40 AM
  4. Linked Lists
    By vendetta in forum New To Java
    Replies: 6
    Last Post: 01-26-2010, 09:23 AM
  5. question about linked lists
    By jkurth in forum Advanced Java
    Replies: 1
    Last Post: 11-11-2007, 09:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •