@Deprecated public class ListHeap<E extends Comparable<E>> extends Object implements Heap<E>
List
as the underlying
data structure. This heap allows values which are equals to be inserted. The heap will
return the top K values which have been added where K is specified by the size passed to
the constructor. K+1 values are not gaurenteed to be kept in the heap or returned in a
particular order.
This is now deprecated and will be removed in Release 1.8.1Constructor and Description |
---|
ListHeap(int sz)
Deprecated.
Creates a new heap of the specified size.
|
ListHeap(int sz,
Comparator<E> c)
Deprecated.
Creates a new heap with the specified size using the sorted based on the
specified comparator.
|
Modifier and Type | Method and Description |
---|---|
void |
add(E o)
Deprecated.
Adds the specified object to the heap.
|
void |
clear()
Deprecated.
Clears the contents of the heap.
|
E |
extract()
Deprecated.
Removes the smallest element from the heap and returns it.
|
E |
first()
Deprecated.
Returns the smallest element of the heap.
|
boolean |
isEmpty()
Deprecated.
Returns whether the heap is empty.
|
Iterator<E> |
iterator()
Deprecated.
Returns an iterator over the elements of the heap.
|
E |
last()
Deprecated.
Returns the largest element of the heap.
|
int |
size()
Deprecated.
Returns the size of the heap.
|
public ListHeap(int sz, Comparator<E> c)
sz
- The size of the heap.c
- The comparator to be used to sort heap elements.public ListHeap(int sz)
sz
- The size of the new heap.public int size()
Heap
size
in interface Heap<E extends Comparable<E>>
public E extract()
Heap
extract
in interface Heap<E extends Comparable<E>>
public E first()
Heap
first
in interface Heap<E extends Comparable<E>>
public E last()
Heap
last
in interface Heap<E extends Comparable<E>>
public void add(E o)
Heap
add
in interface Heap<E extends Comparable<E>>
o
- The object to add to the heap.public void clear()
Heap
clear
in interface Heap<E extends Comparable<E>>
public Iterator<E> iterator()
Heap
iterator
in interface Heap<E extends Comparable<E>>
Copyright © 2017 The Apache Software Foundation. All rights reserved.