The size() method of DelayQueue class in Java is used to return the number of elements present in the given queue. If the number of elements is greater than Integer.MAX_VALUE then Integer.MAX_VALUE is returned as the size of this DelayQueue.
public int size()
Parameters: It does not takes in any parameter.
Return Value: It returns an integer which is the length of the queue.
Below program illustrate the size() method of DelayQueue in Java:
Size : 1
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.