methods of queue in java
AI 回答
由 glm-4-flash 生成 · 仅供参考,请自行核实
1. `add(E e)`: Adds an element to the end of the queue.
2. `offer(E e)`: Adds an element to the end of the queue. Same as `add`.
3. `remove()`: Removes and returns the head of the queue.
4. `poll()`: Retrieves and removes the head of the queue, or returns `null` if the queue is empty.
5. `element()`: Retrieves, but does not remove, the head of the queue, or returns `null` if the queue is empty.
6. `peek()`: Retrieves, but does not remove, the head of the queue, or returns `null` if the queue is empty. Same as `element`.
7. `size()`: Returns the number of elements in the queue.
8. `isEmpty()`: Returns `true` if the queue is empty, `false` otherwise.
9. `contains(Object o)`: Returns `true` if the queue contains the specified element.
2. `offer(E e)`: Adds an element to the end of the queue. Same as `add`.
3. `remove()`: Removes and returns the head of the queue.
4. `poll()`: Retrieves and removes the head of the queue, or returns `null` if the queue is empty.
5. `element()`: Retrieves, but does not remove, the head of the queue, or returns `null` if the queue is empty.
6. `peek()`: Retrieves, but does not remove, the head of the queue, or returns `null` if the queue is empty. Same as `element`.
7. `size()`: Returns the number of elements in the queue.
8. `isEmpty()`: Returns `true` if the queue is empty, `false` otherwise.
9. `contains(Object o)`: Returns `true` if the queue contains the specified element.
没有找到「methods of queue in java」相关的内容
建议:检查关键词是否有错别字,或换一个更常见的说法。