wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes advantage Doublylink list over linklist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "advantage Doublylink list over linklist" Watch "advantage Doublylink list over linklist" New topic
Author

advantage Doublylink list over linklist

sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1130
what are the advantage of doublylink lists over normal link list?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19695
    
  20

You can traverse backwards. In a linked list, each node only has a link to the next node. In a doubly linked list, there is also a link to the previous node.

Note that java.util.LinkedList is in fact a doubly linked list.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1130
is ArrayList also dubli linked list?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18840
    
  40

aruna sameera wrote:is ArrayList also dubli linked list?


ArrayList is implemented with an Array -- not a linked list.

Henry
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1130
i think all ArrayList,LinkedList and vector implement the List interface in java?
is it true?
then how is ArrayList come from array?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18840
    
  40

aruna sameera wrote:i think all ArrayList,LinkedList and vector implement the List interface in java?
is it true?
then how is ArrayList come from array?


A linked list is a type of list. Not all lists are linked lists.

Henry
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1130
can you please tell me what are the other types of lists?
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1130
but in my knowledge difference between ArrayList and LinkedList is linked lists is same as arraylist ,but we can traverse both side?is it true?
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1130
and linked List also implemented queue interface?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38851
    
  23
The List documentation should tell you about known implementing classes, but that is only in the Sun API.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19695
    
  20

All the List interface tells you is that you can access elements using an index, that the elements are ordered, and that you can traverse it both ways using the ListIterator returned by one of the two listIterator methods. Nothing more, nothing less. How it works internally differs per implementation.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: advantage Doublylink list over linklist