java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractQueue<T>
cn.wjybxx.base.collection.BetterIndexedPriorityQueue<T>
- 所有已实现的接口:
IndexedCollection<T>,IndexedPriorityQueue<T>,Iterable<T>,Collection<T>,Queue<T>
public class BetterIndexedPriorityQueue<T>
extends AbstractQueue<T>
implements IndexedPriorityQueue<T>
参考自Netty的实现
- 作者:
- wjybxx date 2023/4/3
-
构造器概要
构造器构造器说明BetterIndexedPriorityQueue(IndexedElementHelper<? super T> helper, Class<T> componentType, Comparator<? super T> comparator) BetterIndexedPriorityQueue(IndexedElementHelper<? super T> helper, Class<T> componentType, Comparator<? super T> comparator, int initCapacity) 虽然我们可以通过反射拿到T的类型,但明显用户传入更加高效 -
方法概要
修饰符和类型方法说明voidclear()void清除集合中的所有元素,并不更新队列中节点的索引,通常用在最后清理释放内存的时候。booleanbooleancontainsTyped(T node) booleanisEmpty()iterator()booleanpeek()poll()voidpriorityChanged(T node) 队列中节点元素的优先级发生变化时,将通过该方法通知队列调整booleanbooleanremoveTyped(T node) intsize()从类继承的方法 java.util.AbstractQueue
add, addAll, element, remove从类继承的方法 java.util.AbstractCollection
containsAll, removeAll, retainAll, toArray, toArray, toString从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait从接口继承的方法 java.util.Collection
addAll, containsAll, equals, hashCode, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
构造器详细资料
-
BetterIndexedPriorityQueue
public BetterIndexedPriorityQueue(IndexedElementHelper<? super T> helper, Class<T> componentType, Comparator<? super T> comparator) - 参数:
helper- helpercomponentType- 元素类型comparator- 比较器
-
BetterIndexedPriorityQueue
public BetterIndexedPriorityQueue(IndexedElementHelper<? super T> helper, Class<T> componentType, Comparator<? super T> comparator, int initCapacity) 虽然我们可以通过反射拿到T的类型,但明显用户传入更加高效- 参数:
helper- helpercomponentType- 元素类型comparator- 比较器initCapacity- 初始空间
-
-
方法详细资料
-
size
public int size()- 指定者:
size在接口中Collection<T>- 指定者:
size在类中AbstractCollection<T>
-
isEmpty
public boolean isEmpty()- 指定者:
isEmpty在接口中Collection<T>- 覆盖:
isEmpty在类中AbstractCollection<T>
-
contains
- 指定者:
contains在接口中Collection<T>- 覆盖:
contains在类中AbstractCollection<T>
-
containsTyped
- 指定者:
containsTyped在接口中IndexedCollection<T>
-
clear
public void clear()- 指定者:
clear在接口中Collection<T>- 覆盖:
clear在类中AbstractQueue<T>
-
clearIgnoringIndexes
public void clearIgnoringIndexes()从接口复制的说明:IndexedCollection清除集合中的所有元素,并不更新队列中节点的索引,通常用在最后清理释放内存的时候。 (请确保调用该方法后,不会再访问该集合)- 指定者:
clearIgnoringIndexes在接口中IndexedCollection<T>
-
offer
-
poll
-
peek
-
remove
- 指定者:
remove在接口中Collection<T>- 覆盖:
remove在类中AbstractCollection<T>
-
removeTyped
- 指定者:
removeTyped在接口中IndexedCollection<T>
-
priorityChanged
从接口复制的说明:IndexedPriorityQueue队列中节点元素的优先级发生变化时,将通过该方法通知队列调整- 指定者:
priorityChanged在接口中IndexedPriorityQueue<T>- 参数:
node- 发生优先级变更的节点
-
iterator
- 指定者:
iterator在接口中Collection<T>- 指定者:
iterator在接口中Iterable<T>- 指定者:
iterator在类中AbstractCollection<T>
-