LinkedTransferQueue size() method in Java
The java.util.concurrent.LinkedTransferQueue.size() method is an in-built function in Java which gives the total count of the elements present in the queue.
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.
Parameters: The function does not accept any parameter.
Return Value: The function returns the number of elements in the queue.
Below programs illustrate the LinkedTransferQueue.size() method:
Number of elements in the queue = 10 Queue : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Number of elements in the queue = 5 Queue : [A, B, C, D, E]