
E - Element type. Should be Comparable or a Comparator
needs to be given.public class TopBoundedHeap<E> extends Heap<E>
k Elements only.| Modifier and Type | Field and Description |
|---|---|
protected int |
maxsize
Maximum size
|
private static long |
serialVersionUID
Serial version
|
| Constructor and Description |
|---|
TopBoundedHeap(int maxsize)
Constructor with maximum size only.
|
TopBoundedHeap(int maxsize,
Comparator<? super E> comparator)
Constructor with maximum size and
Comparator. |
| Modifier and Type | Method and Description |
|---|---|
int |
getMaxSize() |
protected void |
handleOverflow(E e)
Handle an overflow in the structure.
|
boolean |
offer(E e) |
add, addAll, castQueueElement, checkHeap, clear, contains, ensureValid, heapifyDown, heapifyDownComparable, heapifyDownComparator, heapifyUp, heapifyUpComparable, heapifyUpComparator, iterator, peek, poll, removeAt, resize, size, toSortedArrayListelement, removecontainsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArrayprivate static final long serialVersionUID
protected int maxsize
public TopBoundedHeap(int maxsize)
maxsize - Maximum sizepublic TopBoundedHeap(int maxsize,
Comparator<? super E> comparator)
Comparator.maxsize - Maximum sizecomparator - Comparator