Binary heap implementation of
Buffer
that provides for removal based on
Comparator
ordering.
The removal order of a binary heap is based on either the natural sort order of its elements or a specified {@linkComparator}. The {@link #remove()}method always returns the first element as determined by the sort order. (The
ascendingOrder
flag in the constructors can be used to reverse the sort order, in which case {@link #remove()}will always remove the last element.) The removal order is
not the same as the order of iteration; elements are returned by the iterator in no particular order.
The {@link #add(Object)}and {@link #remove()}operations perform in logarithmic time. The {@link #get()}operation performs in constant time. All other operations perform in linear time or worse.
Note that this implementation is not synchronized.
@author Peter Donald
@author Ram Chidambaram
@author Michael A. Smith
@author Paul Jack
@author Stephen Colebourne
@author
Simon Harris
@version $Revision: 1.2 $ $Date: 2004/11/19 02:15:18 $