The Java.util.LinkedList.size() method is used to get the size of the Linked list or the number of elements present in the linked list.
Parameters: This method does not take any parameter.
Return Value: This method returns the size or the number of elements present in the LinkedList.
Below program illustrate the Java.util.LinkedList.size() method:
LinkedList:[Geeks, for, Geeks, 10, 20] The size of the linked list is: 5
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.