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
- LinkedList contains() Method in Java
- LinkedList pop() Method in Java
- LinkedList get() Method in Java
- LinkedList add() Method in Java
- LinkedList set() Method in Java
- AbstractQueue element() method in Java with examples
- ArrayList and LinkedList remove() methods in Java with Examples
- LinkedList toArray() method in Java with Example
- LinkedList remove() Method in Java
- LinkedList removeLastOccurrence() method in Java with Example
- LinkedList removeLast() Method in Java
- LinkedList listIterator() Method in Java
- LinkedList removeFirst() 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.