E - 成员类型public class BoundedPriorityQueue<E> extends PriorityQueue<E> implements BoundedCollection<E>
| Constructor and Description |
|---|
BoundedPriorityQueue(int capacity)
构造
|
BoundedPriorityQueue(int capacity,
Comparator<? super E> comparator)
构造
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addAll(E[] c)
添加多个元素
参数为集合的情况请使用 AbstractQueue.addAll(java.util.Collection<? extends E>) |
boolean |
isFull()
是否已满,如果集合已满,不允许新增元素
|
Iterator<E> |
iterator() |
int |
maxSize()
获取集合最大允许容量
|
boolean |
offer(E e)
加入元素,当队列满时,淘汰末尾元素
|
ArrayList<E> |
toList() |
add, clear, comparator, contains, peek, poll, remove, size, spliterator, toArray, toArrayaddAll, element, removecontainsAll, isEmpty, removeAll, retainAll, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArraypublic BoundedPriorityQueue(int capacity)
capacity - 容量public BoundedPriorityQueue(int capacity,
Comparator<? super E> comparator)
capacity - 容量comparator - 比较器public boolean isFull()
BoundedCollectionisFull in interface BoundedCollection<E>public int maxSize()
BoundedCollectionmaxSize in interface BoundedCollection<E>public boolean offer(E e)
public boolean addAll(E[] c)
AbstractQueue.addAll(java.util.Collection<? extends E>)c - 元素数组Copyright © 2025. All rights reserved.