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 {@link Comparator}. The {@link #remove()} method always returns the first element as determinedby 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 performin logarithmic time. The {@link #get()} operation performs in constanttime. All other operations perform in linear time or worse. Note that this implementation is not synchronized. Use {@link org.apache.commons.collections15.BufferUtils#synchronizedBuffer(Buffer)} or{@link org.apache.commons.collections15.buffer.SynchronizedBuffer#decorate(Buffer)}to provide synchronized access to a PriorityBuffer
: Buffer heap = SynchronizedBuffer.decorate(new PriorityBuffer());@author Peter Donald @author Ram Chidambaram @author Michael A. Smith @author Paul Jack @author Matt Hall, John Watkinson, Stephen Colebourne @version $Revision: 1.1 $ $Date: 2005/10/11 17:05:20 $ @since Commons Collections 3.0 (previously BinaryHeap v1.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|