File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Help in understanding the add method particularly addBefore of linkedList Implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Help in understanding the add method particularly addBefore of linkedList Implementation" Watch "Help in understanding the add method particularly addBefore of linkedList Implementation" New topic
Author

Help in understanding the add method particularly addBefore of linkedList Implementation

Sandeep Dharwar
Greenhorn

Joined: Aug 09, 2011
Posts: 4

Can someone walk me through the logic of the addBefore method in 2 cases when the list is empty and when there are several elements in the list. I have included the necessary code required for the understanding of this operation.










Thanks in advance.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 4739
    
    7

Sandeep Dharwar wrote:Can someone walk me through the logic of the addBefore method in 2 cases when the list is empty and when there are several elements in the list. I have included the necessary code required for the understanding of this operation.

My suggestion would be to draw it out on a piece of paper, maybe something like:and now think about (and write down) the operations needed to add a new node before B.

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Help in understanding the add method particularly addBefore of linkedList Implementation
 
Similar Threads
ATOM Feed Parsing - Rome CopyFrom Issue
ATOM Feed Parsing - Rome CopyFrom Issue
RefList help
Trouble with ADT lists
[resolved] Problem with generic methods