deque双向队列的使用
生活随笔
收集整理的這篇文章主要介紹了
deque双向队列的使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Deque的使用
/*** Retrieves and removes the first element of this deque,* or returns {@code null} if this deque is empty.** @return the head of this deque, or {@code null} if this deque is empty*/E pollFirst();/*** Retrieves and removes the last element of this deque,* or returns {@code null} if this deque is empty.** @return the tail of this deque, or {@code null} if this deque is empty*/E pollLast();/*** Retrieves, but does not remove, the first element of this deque.** This method differs from {@link #peekFirst peekFirst} only in that it* throws an exception if this deque is empty.** @return the head of this deque* @throws NoSuchElementException if this deque is empty*/E getFirst();/*** Retrieves, but does not remove, the last element of this deque.* This method differs from {@link #peekLast peekLast} only in that it* throws an exception if this deque is empty.** @return the tail of this deque* @throws NoSuchElementException if this deque is empty*/E getLast();priotityQueue
remove 是刪除最后一個 clear 刪除所有的public void clear() {modCount++;for (int i = 0; i < size; i++)queue[i] = null;size = 0;}總結
以上是生活随笔為你收集整理的deque双向队列的使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java 源码中 unchecked 什
- 下一篇: 最大的数值 239