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