Deque 实现通常不定义 equals 和 hashCode 方法的基于元素的版本,而是从类 Object 继承基于类 Object 本身的版本。最后看一下 Deque 的归属,此接口是 Java 集合框架 ( Java Collections Framework) 的一个成员。
TheDequeinterface of the Java collections framework provides the functionality of a double-ended queue. It extends theQueueinterface. Working of Deque In a regular queue, elements are added from the rear and removed from the front. However, in a deque, we caninsert and remove elements from bot...
public interface Deque<E> extends Queue<E> 线性集合,支持两端插入和移除元素。 名称deque是“双端队列”的缩写,通常发音为“deck”。 大多数Deque实现对它们可能包含的元素数量没有固定限制,但此接口支持容量限制的deques以及没有固定大小限制的deques。 此接口定义了访问双端队列两端元素的方法。 提供了插入,移除...
This interface is a member of theJava Collections Framework. Since: 1.6 Method Summary All MethodsInstance MethodsAbstract Methods Modifier and TypeMethodDescription booleanadd(Ee) Inserts the specified element into the queue represented by this deque (in other words, at the tail of this deque) if...
offerLast in interface Deque<E> 参数 e - 要添加的元素 结果 true (由 Deque.offerLast(E)指定) 异常 NullPointerException - 如果指定的元素为null getFirst public E getFirst() 从界面复制的说明: Deque 检索但不删除此双端队列的第一个元素。 此方法与peekFirst的不同之处仅在于,如果此双...
Dequeimplementations generally do not define element-based versions of theequalsandhashCodemethods, but instead inherit the identity-based versions from classObject. This interface is a member of theJava Collections Framework.
This interface defines methods to access the elements at both ends of the deque. Methods are provided to insert, remove, and examine the element. Each of these methods exists in two forms: one throws an exception if the operation fails, the other returns a ...
Collections.asLifoQueue(Deque<T> deque) Returns a view of a Deque as a Last-in-first-out (Lifo) Queue. Uses of Deque in java.util.concurrent Subinterfaces of Deque in java.util.concurrent Modifier and TypeInterface and Description interface BlockingDeque<E> A Deque that additionally suppor...
peekFirst in interface Deque<E> peekLast public E peekLast() Specified by: peekLast in interface Deque<E> getFirst public E getFirst() Specified by: getFirst in interface Deque<E> Throws: NoSuchElementException getLast public E getLast() Specified by: g...
Methods inherited from interface java.lang.Iterable forEach Constructor Detail LinkedBlockingDeque public LinkedBlockingDeque() Creates a LinkedBlockingDeque with a capacity of Integer.MAX_VALUE. LinkedBlockingDeque public LinkedBlockingDeque(int capacity) Creates a LinkedBlockingDeque with the given (fixed...