1

As per my understanding linked list implementation in java based on double ended linked list not on Doubly linked list (as we dont have any method going backward). Though I can see the method descendingIterator which takes us backward. Not sure we should call it Doubly linked list implementation?

2
  • 1
    Can you rephrase your question? I am not sure what are you asking for - what is your understanding of doubly/double(?) linked list. You even seem to have answered the question yourself. Commented Aug 6, 2011 at 9:00
  • 1
    See: stackoverflow.com/questions/2297110/… Commented Aug 6, 2011 at 10:50

3 Answers 3

4

LinkedList actually satisfies two interfaces: the simple List and the double-linked Deque. So it can do both, depending on how you use it.

(Internally, it does keep references of previous and next element. So it is doubly linked if you want to call it like this.)

Sign up to request clarification or add additional context in comments.

Comments

2

Sure, you can go forward and backward : just get a ListIterator by calling myList.listIterator(), and you'll have access to "next()" and "previous()" methods.

source : http://download.oracle.com/javase/1.4.2/docs/api/java/util/ListIterator.html

1 Comment

1

Yes you can do it with ListIterator interface provided by JavaSE. Using this you can go in forward and backward direction because it has function next() and previous().It has also functions to check next previous element like hasNext() and hasPrevious().It is nothing but the double-ended linked list.Hope you get it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.