aspose file tools*
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 liyanage
Ranch Hand

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

Joined: Oct 27, 2005
Posts: 19670
    
  18

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 liyanage
Ranch Hand

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

Joined: Sep 28, 2004
Posts: 18720
    
  40

aruna sameera wrote:is ArrayList also dubli linked list?


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

Henry
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1085
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: 18720
    
  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 liyanage
Ranch Hand

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

Joined: Nov 25, 2008
Posts: 1085
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 liyanage
Ranch Hand

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

Joined: Oct 13, 2005
Posts: 38363
    
  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: 19670
    
  18

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.
 
Consider Paul's rocket mass heater.
 
subject: advantage Doublylink list over linklist