Home » Java Deque size() Method with Examples

Java Deque size() Method with Examples

by Online Tutorials Library

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:

  1. 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

Test it Now

Output:

The final deque is given as :   55.8  22.3  89.0  22.3  The size of the deque is : 4  

Example 2

Test it Now

Output:

The final deque is given as :   Computer  Programming  Language  The size of the deque is : 3  

Example 3

Test it Now

Output:

The final deque is given as : [A, B, C, D, E]  The size of the deque is : 5  
Next TopicJava Deque

You may also like