Module io.netty5.common
Package io.netty5.util.internal
Class DefaultPriorityQueue<T extends PriorityQueueNode>
- java.lang.Object
 - 
- java.util.AbstractCollection<E>
 - 
- java.util.AbstractQueue<T>
 - 
- io.netty5.util.internal.DefaultPriorityQueue<T>
 
 
 
 
- 
- Type Parameters:
 T- The object that is maintained in the queue.
- All Implemented Interfaces:
 PriorityQueue<T>,Iterable<T>,Collection<T>,Queue<T>
public final class DefaultPriorityQueue<T extends PriorityQueueNode> extends AbstractQueue<T> implements PriorityQueue<T>
A priority queue which uses natural ordering of elements. Elements are also required to be of typePriorityQueueNodefor the purpose of maintaining the index in the priority queue. 
- 
- 
Constructor Summary
Constructors Constructor Description DefaultPriorityQueue(Comparator<T> comparator, int initialSize) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()voidclearIgnoringIndexes()Removes all of the elements from thisPriorityQueuewithout callingPriorityQueueNode.priorityQueueIndex(DefaultPriorityQueue)or explicitly removing references to them to allow them to be garbage collected.booleancontains(Object o)booleancontainsTyped(T node)Same asCollection.contains(Object)but typed using generics.booleanisEmpty()Iterator<T>iterator()This iterator does not return elements in any particular order.booleanoffer(T e)Tpeek()Tpoll()voidpriorityChanged(T node)Notify the queue that the priority fornodehas changed.booleanremove(Object o)booleanremoveTyped(T node)Same asCollection.remove(Object)but typed using generics.intsize()Object[]toArray()<X> X[]toArray(X[] a)- 
Methods inherited from class java.util.AbstractQueue
add, addAll, element, remove 
- 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString 
- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 
- 
Methods inherited from interface java.util.Collection
addAll, containsAll, equals, hashCode, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
DefaultPriorityQueue
public DefaultPriorityQueue(Comparator<T> comparator, int initialSize)
 
 - 
 
- 
Method Detail
- 
size
public int size()
- Specified by:
 sizein interfaceCollection<T extends PriorityQueueNode>- Specified by:
 sizein classAbstractCollection<T extends PriorityQueueNode>
 
- 
isEmpty
public boolean isEmpty()
- Specified by:
 isEmptyin interfaceCollection<T extends PriorityQueueNode>- Overrides:
 isEmptyin classAbstractCollection<T extends PriorityQueueNode>
 
- 
contains
public boolean contains(Object o)
- Specified by:
 containsin interfaceCollection<T extends PriorityQueueNode>- Overrides:
 containsin classAbstractCollection<T extends PriorityQueueNode>
 
- 
containsTyped
public boolean containsTyped(T node)
Description copied from interface:PriorityQueueSame asCollection.contains(Object)but typed using generics.- Specified by:
 containsTypedin interfacePriorityQueue<T extends PriorityQueueNode>
 
- 
clear
public void clear()
- Specified by:
 clearin interfaceCollection<T extends PriorityQueueNode>- Overrides:
 clearin classAbstractQueue<T extends PriorityQueueNode>
 
- 
clearIgnoringIndexes
public void clearIgnoringIndexes()
Description copied from interface:PriorityQueueRemoves all of the elements from thisPriorityQueuewithout callingPriorityQueueNode.priorityQueueIndex(DefaultPriorityQueue)or explicitly removing references to them to allow them to be garbage collected. This should only be used when it is certain that the nodes will not be re-inserted into this or any otherPriorityQueueand it is known that thePriorityQueueitself will be garbage collected after this call.- Specified by:
 clearIgnoringIndexesin interfacePriorityQueue<T extends PriorityQueueNode>
 
- 
offer
public boolean offer(T e)
- Specified by:
 offerin interfaceQueue<T extends PriorityQueueNode>
 
- 
poll
public T poll()
- Specified by:
 pollin interfaceQueue<T extends PriorityQueueNode>
 
- 
peek
public T peek()
- Specified by:
 peekin interfaceQueue<T extends PriorityQueueNode>
 
- 
remove
public boolean remove(Object o)
- Specified by:
 removein interfaceCollection<T extends PriorityQueueNode>- Overrides:
 removein classAbstractCollection<T extends PriorityQueueNode>
 
- 
removeTyped
public boolean removeTyped(T node)
Description copied from interface:PriorityQueueSame asCollection.remove(Object)but typed using generics.- Specified by:
 removeTypedin interfacePriorityQueue<T extends PriorityQueueNode>
 
- 
priorityChanged
public void priorityChanged(T node)
Description copied from interface:PriorityQueueNotify the queue that the priority fornodehas changed. The queue will adjust to ensure the priority queue properties are maintained.- Specified by:
 priorityChangedin interfacePriorityQueue<T extends PriorityQueueNode>- Parameters:
 node- An object which is in this queue and the priority may have changed.
 
- 
toArray
public Object[] toArray()
- Specified by:
 toArrayin interfaceCollection<T extends PriorityQueueNode>- Overrides:
 toArrayin classAbstractCollection<T extends PriorityQueueNode>
 
- 
toArray
public <X> X[] toArray(X[] a)
- Specified by:
 toArrayin interfaceCollection<T extends PriorityQueueNode>- Overrides:
 toArrayin classAbstractCollection<T extends PriorityQueueNode>
 
- 
iterator
public Iterator<T> iterator()
This iterator does not return elements in any particular order.- Specified by:
 iteratorin interfaceCollection<T extends PriorityQueueNode>- Specified by:
 iteratorin interfaceIterable<T extends PriorityQueueNode>- Specified by:
 iteratorin classAbstractCollection<T extends PriorityQueueNode>
 
 - 
 
 -