数据结构-Queue
来源:互联网 发布:手机光绘软件 编辑:程序博客网 时间:2024/06/05 06:11
Collection
operations, queues provide additional insertion, extraction, and inspection operations. Each of these methods exists in two forms: one throws an exception if the operation fails, the other returns a special value (either null or false, depending on the operation). The latter form of the insert operation is designed specifically for use with capacity-restricted Queueimplementations; in most implementations, insert operations cannot fail. Throws exceptionReturns special valueInsertadd(e)
offer(e)
Removeremove()
poll()
Examineelement()
peek()
The offer
method inserts an element if possible, otherwise returning false. This differs from the Collection.add
method, which can fail to add an element only by throwing an unchecked exception. The offer method is designed for use when failure is a normal, rather than exceptional occurrence, for example, in fixed-capacity (or "bounded") queues.
The remove()
and poll()
methods remove and return the head of the queue. Exactly which element is removed from the queue is a function of the queue's ordering policy, which differs from implementation to implementation. The remove() and poll() methods differ only in their behavior when the queue is empty: the remove() method throws an exception, while the poll() method returns null.
The element()
and peek()
methods return, but do not remove, the head of the queue.
- 数据结构-Queue
- 队列数据结构 Queue.h
- 【数据结构】顺序队列 Queue
- queue的实现 数据结构
- <数据结构>stack & queue
- Java 数据结构之Queue
- 数据结构-队列(queue)
- linkin大话数据结构--Queue
- 数据结构_队列(queue)
- TAIL Queue数据结构
- 数据结构-队列(queue)
- 数据结构复习 - 队列Queue
- 计蒜客 数据结构 Queue
- 队列(queue)数据结构
- 数据结构-队列(Queue)
- [C++数据结构]队列Queue
- 数据结构——queue
- 【四】数据结构之Queue
- 进程和线程的联系和区别
- 二、oc中的setter与getter方法以及点语法
- informatica 学习日记整理
- C Primer Plus 练习 7-5
- spring quartz 集群配置
- 数据结构-Queue
- 我的学习目标
- 3/7/2015
- 【连通图|强连通分量+缩点】POJ-1236 Network of Schools
- [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.explicit_defaults_for_timestamp
- node-webkit中js连接sqlite3文件型数据库
- 【node.js学习】--(7)--安装Mongodb
- 每日反省
- C零散_摘自C程序设计_结构体中.和->区别