
V - Value typepublic interface IntegerObjectHeap<V>
| Modifier and Type | Interface and Description |
|---|---|
static interface |
IntegerObjectHeap.UnsortedIter<V>
Unsorted iterator - in heap order.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int key,
V val)
Add a key-value pair to the heap
|
void |
add(int key,
V val,
int k)
Add a key-value pair to the heap if it improves the top.
|
void |
clear()
Clear the heap contents.
|
boolean |
isEmpty()
Is the heap empty?
|
int |
peekKey()
Get the current top key
|
V |
peekValue()
Get the current top value
|
void |
poll()
Remove the first element
|
void |
replaceTopElement(int key,
V val)
Combined operation that removes the top element, and inserts a new element
instead.
|
int |
size()
Query the size
|
IntegerObjectHeap.UnsortedIter<V> |
unsortedIter()
Get an unsorted iterator to inspect the heap.
|
void add(int key,
V val)
key - Keyval - Valuevoid add(int key,
V val,
int k)
key - Keyval - Valuek - Desired maximum sizevoid replaceTopElement(int key,
V val)
key - Key of new elementval - Value of new elementint peekKey()
V peekValue()
void poll()
void clear()
int size()
boolean isEmpty()
true when the size is 0.IntegerObjectHeap.UnsortedIter<V> unsortedIter()