Hi All, Can we implement linked list in java.Though there are Collection classes for this purpose and we have LIst interface in that.. but is it possible to implement linked list as we dont have any pointers in Java.. Can i get some useful links for data structures in Java. Thanks in advance. Regards, Harry
Here is the sample code from the book: "Data Structures and Algorithms in Java" by Robert LaFore.
Published: NOV 06, 2002 ISBN: 0672324539
<a href="http://www.mqtips.com" target="_blank" rel="nofollow">MQMessenger</a> - free Java app for MQSeries
Joined: May 02, 2001
HI pals, thanks for all ur resplies.. but we do have a class LinkedList in Collection interface. so is it same as this linked list. can we use it in same contextg as linked list of data structures. IF it is the same, then why do we need to make our own LinkedList. Regards, Harjinder
Unless you are doing an exerice for school work, you do not need to make your own LinkedList. The one in the Collections API will do just fine (and probably better; I imagine that it is optimized for iteration, where a standard "you-write-it-yourself" one isn't). The only drawback is that the Collections LinkedList only works with objects; primitives are not acceptable. (Although with the forthcoming release of Java 1.5, the auto-boxing feature will automatically wrap your primitives in the appropriate wrapper class, so even this drawback is soon to go away.)
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Joined: Jan 29, 2003
And wouldn't it be nice to have a linked list of Galoshes so you don't have to cast (Galosh) every time you get one out of the collection?