Does Java 1.5 have circular linkedlist implementation?

Discussion in 'Java' started by Sharp, Mar 12, 2005.

  1. Sharp

    Sharp Guest

    Hi
    Does Java 1.5 have circular linkedlist implementation?
    if not, where can I find a 3rd party API that has it?

    Cheers
    Sharp
    Sharp, Mar 12, 2005
    #1
    1. Advertising

  2. Sharp

    Tony Morris Guest

    "Sharp" <> wrote in message
    news:_qvYd.193927$...
    > 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.

    --
    Tony Morris
    http://xdweb.net/~dibblego/
    Tony Morris, Mar 12, 2005
    #2
    1. Advertising

  3. In article <v2wYd.193981$>,
    "Tony Morris" <> wrote:

    > "Sharp" <> wrote in message
    > news:_qvYd.193927$...
    > > 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.


    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.
    Kevin McMurtrie, Mar 12, 2005
    #3
  4. Kevin McMurtrie coughed up:
    > In article <v2wYd.193981$>,
    > "Tony Morris" <> wrote:
    >
    >> "Sharp" <> wrote in message
    >> news:_qvYd.193927$...
    >>> 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.

    >
    > 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.



    --
    Whyowhydidn'tsunmakejavarequireanuppercaselettertostartclassnames....
    Thomas G. Marshall, Mar 13, 2005
    #4
  5. Sharp

    tennenrishin

    Joined:
    Jul 3, 2011
    Messages:
    2
    Last edited: Aug 22, 2011
    tennenrishin, Jul 5, 2011
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kiuhnm
    Replies:
    16
    Views:
    727
    Jonathan Mcdougall
    Jan 3, 2005
  2. Replies:
    1
    Views:
    815
    Oliver Wong
    Jun 12, 2006
  3. H.
    Replies:
    5
    Views:
    397
    Muntasir Azam Khan
    Apr 2, 2007
  4. Replies:
    9
    Views:
    1,109
    Mike Schilling
    Oct 29, 2009
  5. Replies:
    9
    Views:
    421
    Mike Schilling
    Oct 29, 2009
Loading...

Share This Page