The element() method of java.util.LinkedList class retrieves, but does not remove, the head (first element) of this list.
public E element()
Return Value: This method returns the head of this list.
Below are the examples to illustrate the element() method
LinkedList : [10, 20, 30] Head of list : 10
LinkedList : [A, B, C] Head of list : A
- LinkedList descendingIterator() method in Java with Examples
- Java.util.LinkedList.poll(), pollFirst(), pollLast() with examples in Java
- ArrayList and LinkedList remove() methods in Java with Examples
- LinkedList contains() Method in Java
- LinkedList pop() Method in Java
- LinkedList set() Method in Java
- LinkedList get() Method in Java
- LinkedList add() Method in Java
- AbstractQueue element() method in Java with examples
- BlockingDeque element() method in java with examples
- LinkedList toArray() method in Java with Example
- LinkedList push() Method in Java
- LinkedList removeLastOccurrence() method in Java with Example
- LinkedList size() Method in Java
- LinkedList listIterator() Method in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.