Class DefaultPriorityQueue<T extends PriorityQueueNode>
java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractQueue<T>
io.netty.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 type
PriorityQueueNode for the purpose of maintaining the index in the priority queue.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidRemoves all of the elements from thisPriorityQueuewithout callingPriorityQueueNode.priorityQueueIndex(DefaultPriorityQueue)or explicitly removing references to them to allow them to be garbage collected.booleanbooleancontainsTyped(T node) Same asCollection.contains(Object)but typed using generics.booleanisEmpty()iterator()This iterator does not return elements in any particular order.booleanpeek()poll()voidpriorityChanged(T node) Notify the queue that the priority fornodehas changed.booleanbooleanremoveTyped(T node) Same asCollection.remove(Object)but typed using generics.intsize()Object[]toArray()<X> X[]toArray(X[] a) Methods inherited from class AbstractQueue
add, addAll, element, removeMethods inherited from class AbstractCollection
containsAll, removeAll, retainAll, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Collection
addAll, containsAll, equals, hashCode, parallelStream, removeAll, removeIf, retainAll, spliterator, stream
-
Constructor Details
-
DefaultPriorityQueue
-
-
Method Details
-
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
- Specified by:
containsin interfaceCollection<T extends PriorityQueueNode>- Overrides:
containsin classAbstractCollection<T extends PriorityQueueNode>
-
containsTyped
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
- Specified by:
offerin interfaceQueue<T extends PriorityQueueNode>
-
poll
- Specified by:
pollin interfaceQueue<T extends PriorityQueueNode>
-
peek
- Specified by:
peekin interfaceQueue<T extends PriorityQueueNode>
-
remove
- Specified by:
removein interfaceCollection<T extends PriorityQueueNode>- Overrides:
removein classAbstractCollection<T extends PriorityQueueNode>
-
removeTyped
Description copied from interface:PriorityQueueSame asCollection.remove(Object)but typed using generics.- Specified by:
removeTypedin interfacePriorityQueue<T extends PriorityQueueNode>
-
priorityChanged
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
- 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
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>
-