|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Heap<E>
Interface for interacting with a Heap data structure. This implementation extract objects from smallest to largest based on either their natural ordering or the comparator provided to an implementation. While this is a typical of a heap it allows this objects natural ordering to match that of other sorted collections.
Method Summary | |
---|---|
void |
add(E o)
Adds the specified object to the heap. |
void |
clear()
Clears the contents of the heap. |
E |
extract()
Removes the smallest element from the heap and returns it. |
E |
first()
Returns the smallest element of the heap. |
boolean |
isEmpty()
Returns whether the heap is empty. |
Iterator<E> |
iterator()
Returns an iterator over the elements of the heap. |
E |
last()
Returns the largest element of the heap. |
int |
size()
Returns the size of the heap. |
Method Detail |
---|
E extract()
E first()
E last()
void add(E o)
o
- The object to add to the heap.int size()
boolean isEmpty()
Iterator<E> iterator()
void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |