Java Deque size() 方法

2025 年 3 月 22 日 | 阅读需 2 分钟

Deque 接口的 size() 方法用于返回给定双端队列中元素的总数。

语法

参数

上述方法只需要一个参数

  1. 需要移除的元素 'o'。

指定者

Collection<E> 接口中的 size

返回

上述方法用于返回给定双端队列中元素的总数。

示例 1

输出

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

示例 2

输出

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

示例 3

输出

The final deque is given as : [A, B, C, D, E]
The size of the deque is : 5
下一主题Java Deque