org.apache.commons.collections

Interface PriorityQueue

Known Implementing Classes:
BinaryHeap, SynchronizedPriorityQueue

public interface PriorityQueue

Defines a collection for priority queues, which can insert, peek and pop.

This interface is now replaced by the Buffer interface.

Version:
$Revision: 1.14 $ $Date: 2004/02/18 01:15:42 $
Author:
Peter Donald
Since:
Commons Collections 1.0

Method Summary

void
clear()
Clear all elements from queue.
void
insert(Object element)
Insert an element into queue.
boolean
isEmpty()
Test if queue is empty.
Object
peek()
Return element on top of heap but don't remove it.
Object
pop()
Return element on top of heap and remove it.

Method Details

clear

public void clear()
Clear all elements from queue.

insert

public void insert(Object element)
Insert an element into queue.
Parameters:
element - the element to be inserted

isEmpty

public boolean isEmpty()
Test if queue is empty.
Returns:
true if queue is empty else false.

peek

public Object peek()
Return element on top of heap but don't remove it.
Returns:
the element at top of heap

pop

public Object pop()
Return element on top of heap and remove it.
Returns:
the element at top of heap

Copyright © 2001-2006 Apache Software Foundation. All Rights Reserved.