What is LinkedList?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
What is LinkedList?
Rating:
LinkedList is a class that extends the AbstractSequentialList class and implements the List and Queue interfaces. LinkedList is a generic class. The class declaration is given below:
Here, E specifies the type of objects that the list will hold.
It defines the following two constructors:
- LinkedList(): It builds an empty linked list.
- LinkedList(Collection <?extends E >c): It builds a linked list that is initialized with the elements of a collection c
- void addFirst(E obj): This method inserts an element at the beginning of the list.
- void addLast(E obj): This method inserts an element at the end of a list
- E getFirst(): This method is used to retrieve the first element from the list.
- E getLast(): This method retrieves the last element from the list.
- E removeFirst(): This removes the first element from the list.
- E removeLast(): This method removes the last element from the list.
Rating:
Was this information helpful?
Other articles
- What is a local class?
- What is an ObjectInputStream?
- What is the run() method?
- What is pass-by-reference?
- What is the FileWriter class?