该接口扩展了 Queue 接口。当作为队列用时,会产生 FIFO(First-In-First-Out 先进先出)行为。元素被从双端队列的末尾添加,并从开头删除。从 Queue 接口继承的方法与 Deque 的相关方法完全等价,如下所示:Queue 和 Deque 方法的比较,QueueMethod 等价的DequeMethod add(e)addLast(e)offer(e) offerLast...
This interface is a member of theJava Collections Framework. Since: 1.6 Method Summary All MethodsInstance MethodsAbstract Methods Modifier and TypeMethod and Description booleanadd(Ee) Inserts the specified element into the queue represented by this deque (in other words, at the tail of this deque...
Note that the#peek peekmethod works equally well when a deque is used as a queue or a stack; in either case, elements are drawn from the beginning of the deque. This interface provides two methods to remove interior elements,#removeFirstOccurrence removeFirstOccurrenceand#removeLastOccurrence ...
This method is equivalent to#removeFirst(). Java documentation forjava.util.Deque.pop(). Portions of this page are modifications based on work created and shared by theAndroid Open Source Projectand used according to terms described in theCreative Commons 2.5 Attribution License. ...
Peek Method Reference Feedback Definition Namespace: Java.Util.Concurrent Assembly: Mono.Android.dll Retrieves, but does not remove, the head of the queue represented by this deque (in other words, the first element of this deque), or returns null i...
IQueue AsLifoQueue (Java.Util.IDeque deque); Parameters deque IDeque the deque Returns IQueue the queue Attributes RegisterAttribute JavaTypeParametersAttribute Remarks Returns a view of a Deque as a Last-in-first-out (Lifo) Queue. Method add is mapped to push, remove is mapped to pop...
The basic insertion, removal and retrieval operations in theDequeinterfaceaddFirst,addLast,removeFirst,removeLast,getFirstandgetLast. The methodaddFirstadds an element at the head whereasaddLastadds an element at the tail of theDequeinstance.
import java.util.Iterator; public class DequeDemo { publicstaticvoidmain(String[]args){// TODO Auto-generated method stubArrayDeque<String>aDeque=newArrayDeque<>();aDeque.addFirst("tea");aDeque.addFirst("milk");aDeque.addFirst("coffee");aDeque.addLast("sugar");/* Iterate through elements...
* Retrieves, but does not remove, the head of this queue. This method * differs from {@link #peek peek} only in that it throws an exception * if this queue is empty. * * @return the head of this queue * @throws NoSuchElementException if this queue is empty ...
Detail: Field | Constr | Method compact1, compact2, compact3 java.util.concurrent Class LinkedBlockingDeque<E>java.lang.Object java.util.AbstractCollection<E> java.util.AbstractQueue<E> java.util.concurrent.LinkedBlockingDeque<E> Type Parameters: E - the type of elements held in this collectio...