Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2005

Tip: Looking for answers? Try searching our database.

Does Java 1.5 have circular linkedlist implementation?

Thread view: 
Sharp - 12 Mar 2005 05:50 GMT
Hi
Does Java 1.5 have circular linkedlist implementation?
if not, where can I find a 3rd party API that has it?

Cheers
Sharp
Tony Morris - 12 Mar 2005 06:32 GMT
> Hi
> Does Java 1.5 have circular linkedlist implementation?
> if not, where can I find a 3rd party API that has it?
>
> Cheers
> Sharp

No.
Google could turn one up, but I see no reason to spend the 5 or 10 minutes
writing it yourself instead (perhaps a tad more if you write tests and
javadoc, like you should).
Note that a circular linked list cannot be implemented successfully (without
design flaws) by implementing the java.util.List interface -I've seen many
of my university students try.

Signature

Tony Morris
http://xdweb.net/~dibblego/

Kevin McMurtrie - 12 Mar 2005 07:58 GMT
> > Hi
> > Does Java 1.5 have circular linkedlist implementation?
[quoted text clipped - 10 lines]
> design flaws) by implementing the java.util.List interface -I've seen many
> of my university students try.

I don't see why it can't implement List if given a reference point and
direction.  It couldn't cleanly support concurrent modification through
itself and an Iterator but that's a common limitation.
Thomas G. Marshall - 13 Mar 2005 07:12 GMT
Kevin McMurtrie coughed up:

>>> Hi
>>> Does Java 1.5 have circular linkedlist implementation?
[quoted text clipped - 13 lines]
> I don't see why it can't implement List if given a reference point and
> direction.

I've seen this discussion a few times.  You can specify a reference point,
but that reference point is hard to pin down in a generic sense.  What
constitutes the head, or better put, "the way in" to a circular linked list
is often goofy.

> It couldn't cleanly support concurrent modification
> through itself and an Iterator but that's a common limitation.

You could specify a ListIterator, which is what you get from List
implementors anyway.  And a ListIterator has the add() and remove() methods
needed for such concurrent things.  Once you've chosen that arbitrary head
and tail in the circle, the ListIterator could be designed in a similar way
it is for ArrayList.

Signature

Whyowhydidn'tsunmakejavarequireanuppercaselettertostartclassnames....



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.