69
Java Deque size() Method
The size() method of Deque interface is used to return the total number of elements present in the given deque.
Syntax:
Parameter:
The above method requires only one parameter:
- The element ‘o’ that needs to be removed.
Specified by:
size in interface Collection<E>
Return:
The above method is used to return the total number of elements present in the given deque.
Example 1
Output:
The final deque is given as : 55.8 22.3 89.0 22.3 The size of the deque is : 4
Example 2
Output:
The final deque is given as : Computer Programming Language The size of the deque is : 3
Example 3
Output:
The final deque is given as : [A, B, C, D, E] The size of the deque is : 5
Next TopicJava Deque