DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   doubly linked list implementation (http://www.daniweb.com/forums/thread12036.html)

raneka17 Oct 7th, 2004 8:32 am
doubly linked list implementation
 
i'm creating a guestbook in java wherein it gets inputs(name,message) from a user then it will store this as an object. it basically works like a guestbook in webpages only that it will have a delete option. how can i do this? can anyone give me an idea please.

Narue Oct 7th, 2004 9:17 am
Re: doubly linked list implementation
 
>how can i do this?
By opening your Java book and figuring out how to do each of the parts of this program. Can you read a name and a message? Can you write a class to hold a message? Can you display text? Get that working with an array first, then you can switch to a more complicated data structure like a linked list.

And by the way, just about every book on programming out there has a decent description of linked lists along with an implementation. Double linked lists are just a simple jump up from single linked lists. The only relatively hard part is making sure that all pointers are updated properly.

So, what exactly are you having trouble with?

raneka17 Oct 7th, 2004 10:32 pm
Re: doubly linked list implementation
 
yeah, i can read the name and message.. but my program should have a delete option and i don't know how to do it. i can do it with arrays but my project requires me to use doubly linked list not arrays. every post has a message number. and the most recent should be at the top but it doesn't. then i have this textfield that gets the message number to refer to the message to delete. i think this approach is wrong. i have two constructors in my helper class(the main class is a gui), one gets all the strings needed(name,message etc.) and the other gets this object and sets its prev and next links. using this object i can't access the strings.
this is what my code looks like: (wherein o is the object)
item1 = o.element().getame();

i really need help! thanks for replying in advance. more power.


All times are GMT -4. The time now is 4:49 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC