LinkedList

For Java Certification Exam (OCJP) Practice Questions, refer http://talks.skilltoz.com/java-11-certification-exam-questions/

What is a LinkedList?

LinkedList is a doubly-linked list implementation of the List and Deque interfaces. It does not support fast random access of elements.

What are the super types of LinkedList?

The LinkedList class implements the List and Deque interfaces. The Deque interface extends the Queue interface. Queue and List interfaces extend Collection interface.
Hence, it is possible to assign a LinkedList object to a variable of type Deque, List, Queue or Collection. So the following assignments are legal.

Deque<Integer> deque = new LinkedList<>();
List<Integer> list = new LinkedList<>();
Queue<Integer> queue = new LinkedList<>();
Collection<Integer> collection = new LinkedList<>();

For more details on LinkedList, please refer https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/LinkedList.html

Leave a Reply

Your email address will not be published. Required fields are marked *