aspose file tools*
The moose likes Beginning Java and the fly likes Java Linked List Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Linked List" Watch "Java Linked List" New topic
Author

Java Linked List

nomss arra
Greenhorn

Joined: Feb 18, 2011
Posts: 3
So I need help with my paste method here. Each time it is called, new Node should be created and be inserted to the left of current. Thank You!

http://pastebin.com/DqC0dZ4N

http://pastebin.com/1cw9SQfj
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38793
    
  23
Welcome to the Ranch

Please copy the offending method here, using the code button. Put the code after the first ] and before the second [.
nomss arra
Greenhorn

Joined: Feb 18, 2011
Posts: 3

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38793
    
  23
What you do is to draw three squares, labelled last temp and previous. Then you put lines between them for each action, or erase the lines, and you find whether you are adding the new node to the right or the left of the original node.
Also, why are you saying "if (current == last)"? That would only add a node at the end of the list, and presumably you want to be able to paste into the middle.
nomss arra
Greenhorn

Joined: Feb 18, 2011
Posts: 3

I want paste() to paste to the right of current.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38793
    
  23
Yes? And what have you changed in the more recent code?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Linked List