About the List, Linkedlist and Arraylist, which one is a one way list and which one is Doubly-linked list? And how could we reverse it?
2 Answers
List
An interface that merely defines behavior of lists.ArrayList
AListimplementation, backed by an array. It is not a linked list.LinkedList
AListimplementation, backed by an implementation of a doubly-linked list.
If you want a single-linked list, you'll have to write it yourself.
I should point out that making a single linked list that implements java.util.List is not easy. It requires you to have a ListIterator<E>, and part of the ListIterator specification is that you can traverse in either direction with methods hasPrevious, previous, and previousIndex. So to keep it both efficient and true to the single linked list mantra would be very difficult.