⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
org.apache.commons.collections

Interface PriorityQueue


public interface PriorityQueue

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

This interface is now replaced by the Buffer interface.

Since:
Commons Collections 1.0
Author:
Peter Donald

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
Throws:
- if the specified element's type prevents it from being compared to other items in the queue to determine its relative priority.

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
Throws:
- if isEmpty() == true

pop

public Object pop()

Return element on top of heap and remove it.

Returns:
the element at top of heap
Throws:
- if isEmpty() == true