接口声明
public interface Queue<E> extends Collection<E>
主要方法
- boolean add(e)
- E remove()
- E element()
这三个方法在添加(IllegalStateException),移除(NoSuchElementException),获取元素(NoSuchElementException)失败时抛出异常
- E offer(e)
- E poll()
- E peek()
这三个方法在添加,移除,获取元素失败时不抛异常,而且返回Boolen值或者NULL