public class IntPriorityQueue extends AbstractQueue<Integer> implements Serializable
PriorityQueue
filled with
integers. This queue can optionally support log(n) removal of key
values at increased memory cost.Modifier and Type | Class and Description |
---|---|
static class |
IntPriorityQueue.Mode
Sets the mode used for the priority queue.
|
Modifier and Type | Field and Description |
---|---|
static Comparator<Integer> |
naturalComparator |
Constructor and Description |
---|
IntPriorityQueue()
Creates a new integer priority queue using
IntPriorityQueue.Mode.STANDARD |
IntPriorityQueue(int initialSize,
Comparator<Integer> comparator)
Creates a new integer priority queue using the specified comparison and
IntPriorityQueue.Mode.STANDARD |
IntPriorityQueue(int initialSize,
Comparator<Integer> comparator,
IntPriorityQueue.Mode fastValueRemove)
Creates a new integer priority queue
|
IntPriorityQueue(int initialSize,
IntPriorityQueue.Mode fastValueRemove)
Creates a new integer priority queue
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
contains(Object o) |
Iterator<Integer> |
iterator() |
boolean |
offer(int e) |
boolean |
offer(Integer e) |
Integer |
peek() |
Integer |
poll() |
boolean |
remove(Object o) |
protected int |
removeHeapNode(int i)
Removes the node specified from the heap
|
int |
size() |
add, addAll, element, remove
containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
public static final Comparator<Integer> naturalComparator
public IntPriorityQueue()
IntPriorityQueue.Mode.STANDARD
public IntPriorityQueue(int initialSize, Comparator<Integer> comparator)
IntPriorityQueue.Mode.STANDARD
initialSize
- the initial storage size of the queuecomparator
- the comparator to determine the order of elements in the queuepublic IntPriorityQueue(int initialSize, IntPriorityQueue.Mode fastValueRemove)
initialSize
- the initial storage size of the queuefastValueRemove
- the mode that whether or not, and how, fast
arbitrary object removal from the queue will be done.public IntPriorityQueue(int initialSize, Comparator<Integer> comparator, IntPriorityQueue.Mode fastValueRemove)
initialSize
- the initial storage size of the queuecomparator
- the comparator to determine the order of elements in the queuefastValueRemove
- the mode that whether or not, and how, fast
arbitrary object removal from the queue will be done.public Iterator<Integer> iterator()
iterator
in interface Iterable<Integer>
iterator
in interface Collection<Integer>
iterator
in class AbstractCollection<Integer>
public int size()
size
in interface Collection<Integer>
size
in class AbstractCollection<Integer>
public boolean offer(int e)
protected int removeHeapNode(int i)
i
- the valid heap node index to remove from the heappublic boolean contains(Object o)
contains
in interface Collection<Integer>
contains
in class AbstractCollection<Integer>
public void clear()
clear
in interface Collection<Integer>
clear
in class AbstractQueue<Integer>
public boolean remove(Object o)
remove
in interface Collection<Integer>
remove
in class AbstractCollection<Integer>
Copyright © 2017. All rights reserved.