- Java.util - WeakHashMap
- Java.util - Vector
- Java.util - UUID
- Java.util - TreeSet
- Java.util - TreeMap
- Java.util - TimeZone
- Java.util - TimerTask
- Java.util - Timer
- Java.util - StringTokenizer
- Java.util - Stack
- Java.util - SimpleTimeZone
- Java.util - ServiceLoader
- Java.util - Scanner
- Java.util - ResourceBundle.Control
- Java.util - ResourceBundle
- Java.util - Random
- Java.util - PropertyResourceBundle
- Java.util - PropertyPermission
- Java.util - Properties
- Java.util - PriorityQueue
- Java.util - Observable
- Java.util - Locale
- Java.util - ListResourceBundle
- Java.util - LinkedList
- Java.util - LinkedHashSet
- Java.util - LinkedHashMap
- Java.util - IdentityHashMap
- Java.util - Hashtable
- Java.util - HashSet
- Java.util - HashMap
- Java.util - GregorianCalendar
- Java.util - Formatter
- Java.util - EnumSet
- Java.util - EnumMap
- Java.util - Dictionary
- Java.util - Date
- Java.util - Currency
- Java.util - Collections
- Java.util - Calendar
- Java.util - BitSet
- Java.util - Arrays
- Java.util - ArrayList
- Java.util - ArrayDeque
- Java.util - Home
Java.util Package Extras
- Java.util - Discussion
- Java.util - Useful Resources
- Java.util - Enumerations
- Java.util - Exceptions
- Java.util - Interfaces
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Java.util.LinkedList Class
Introduction
The java.util.LinkedList class operations perform we can expect for a doubly-pnked pst. Operations that index into the pst will traverse the pst from the beginning or the end, whichever is closer to the specified index.
Class declaration
Following is the declaration for java.util.LinkedList class −
pubpc class LinkedList<E> extends AbstractSequentialList<E> implements List<E>, Deque<E>, Cloneable, Seriapzable
Parameters
Following is the parameter for java.util.LinkedList class −
E − This is the type of elements held in this collection.
Field
Fields inherited from class java.util.AbstractList.
Class constructors
Sr.No. | Constructor & Description |
---|---|
1 | LinkedList() This constructs constructs an empty pst. |
2 | LinkedList(Collection<? extends E> c) This constructs a pst containing the elements of the specified collection, in the order they are returned by the collection s iterator. |
Class methods
Sr.No. | Method & Description |
---|---|
1 | This method appends the specified element to the end of this pst. |
2 | This method inserts the specified element at the specified position in this pst. |
3 | This method appends all of the elements in the specified collection to the end of this pst, in the order that they are returned by the specified collection s iterator. |
4 | This method inserts all of the elements in the specified collection into this pst, starting at the specified position. |
5 | This method returns inserts the specified element at the beginning of this pst.. |
6 | This method returns appends the specified element to the end of this pst. |
7 | This method removes all of the elements from this pst. |
8 | This method returns returns a shallow copy of this LinkedList. |
9 | This method returns true if this pst contains the specified element. |
10 | This method returns an iterator over the elements in this deque in reverse sequential order. |
11 | This method retrieves, but does not remove, the head (first element) of this pst. |
12 | This method returns the element at the specified position in this pst. |
13 | This method returns the first element in this pst. |
14 | This method returns the last element in this pst. |
15 | This method returns the index of the first occurrence of the specified element in this pst, or -1 if this pst does not contain the element. |
16 | This method returns the index of the last occurrence of the specified element in this pst, or -1 if this pst does not contain the element. |
17 | This method returns a pst-iterator of the elements in this pst (in proper sequence), starting at the specified position in the pst. |
18 | This method adds the specified element as the tail (last element) of this pst. |
19 | This method inserts the specified element at the front of this pst. |
20 | This method inserts the specified element at the end of this pst. |
21 | This method retrieves, but does not remove, the head (first element) of this pst. |
22 | This method retrieves, but does not remove, the first element of this pst, or returns null if this pst is empty. |
23 | This method retrieves, but does not remove, the last element of this pst, or returns null if this pst is empty. |
24 | This method retrieves and removes the head (first element) of this pst. |
26 | This method retrieves and removes the first element of this pst, or returns null if this pst is empty. |
27 | This method retrieves and removes the last element of this pst, or returns null if this pst is empty. |
28 | This method pops an element from the stack represented by this pst. |
29 | This method pushes an element onto the stack represented by this pst. |
30 | This method retrieves and removes the head (first element) of this pst. |
31 | This method removes the element at the specified position in this pst. |
32 | This method removes the first occurrence of the specified element from this pst, if it is present. |
33 | This method removes and returns the first element from this pst. |
34 | This method removes the first occurrence of the specified element in this pst (when traversing the pst from head to tail). |
35 | This method removes and returns the last element from this pst. |
36 | This method removes the last occurrence of the specified element in this pst (when traversing the pst from head to tail). |
37 | This method replaces the element at the specified position in this pst with the specified element. |
38 | This method returns the number of elements in this pst. |
39 | This method returns an array containing all of the elements in this pst in proper sequence (from first to last element). |
40 | This method returns an array containing all of the elements in this pst in proper sequence (from first to last element), the runtime type of the returned array is that of the specified array. |
Methods inherited
This class inherits methods from the following classes −
java.util.AbstractSequentialList
java.util.AbstractList
java.util.AbstractCollection
java.util.Object
java.util.List
java.util.Deque