Queue接口源码解析
来源:互联网 发布:白知之明的读音是什么 编辑:程序博客网 时间:2024/04/28 02:02
队列
先进先出
入队列:offer
出队列:poll
队头元素:peek
继承:Collection
抽象类
源码如下:
package java.util;public interface Queue<E> extends Collection<E> { /** * 队列插入元素 * * @param e the element to add * @return <tt>true</tt> (as specified by {@link Collection#add}) * @throws IllegalStateException if the element cannot be added at this * time due to capacity restrictions * @throws ClassCastException if the class of the specified element * prevents it from being added to this queue * @throws NullPointerException if the specified element is null and * this queue does not permit null elements * @throws IllegalArgumentException if some property of this element * prevents it from being added to this queue */ boolean add(E e); /** * 队列插入元素 * 插入失败,抛出异常 * @param e the element to add * @return <tt>true</tt> if the element was added to this queue, else * <tt>false</tt> * @throws ClassCastException if the class of the specified element * prevents it from being added to this queue * @throws NullPointerException if the specified element is null and * this queue does not permit null elements * @throws IllegalArgumentException if some property of this element * prevents it from being added to this queue */ boolean offer(E e); /** * 获取队顶元素,并删除该元素 * 空的时候,抛出异常 * @return the head of this queue * @throws NoSuchElementException if this queue is empty */ E remove(); /** * 获取队顶元素,并删除该元素 * 空的时候,返回null * @return the head of this queue, or <tt>null</tt> if this queue is empty */ E poll(); /** * 查看队顶元素,但是不删除该元素、 * 空的时候,抛出异常 * @return the head of this queue * @throws NoSuchElementException if this queue is empty */ E element(); /** * 查看队顶元素,但是不删除该元素、 * 空的时候,返回 null * * @return the head of this queue, or <tt>null</tt> if this queue is empty */ E peek();}
0 0
- Queue接口源码解析
- c# Queue源码解析
- jquery源码解析--queue队列
- Java Queue系列源码解析
- Collection接口源码解析
- List接口源码解析
- Deque接口源码解析
- Set接口源码解析
- SortedSet接口源码解析
- Map接口源码解析
- SortedMap接口源码解析
- NavigableMap接口源码解析
- NavigableSet接口源码解析
- Set接口源码解析
- 解析java.util集合类源码(Queue)
- JDK源码阅读之Queue接口和Deque接口
- queue接口
- Queue接口
- Android性能优化的一些理解
- SQL技巧:SQL Server 比较日期大小的方法
- 怎么安装Apache,php,mysql (一)?
- web开发(十一)之Hibernate关联关系配置
- Android初级教程对大量数据的做分页处理理论知识
- Queue接口源码解析
- 实战fdisk,mkfs磁盘分区格式化
- Buildroot-2012.08交叉编译器制作
- 取模(mod)与取余(rem)的区别——Matlab学习笔记
- 解决Cannot change version of project facet Dynamic Web Module
- gvim的安装以及配置
- label标签
- LVS+keepalived实现HA
- 各种资料链接