org.apache.commons.collections

Interface PriorityQueue

public interface PriorityQueue

Deprecated: Replaced by the Buffer interface and implementations in buffer subpackage. Due to be removed in v4.0.

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

Version: $Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $

Author: Peter Donald

Method Summary
voidclear()
Clear all elements from queue.
voidinsert(Object element)
Insert an element into queue.
booleanisEmpty()
Test if queue is empty.
Objectpeek()
Return element on top of heap but don't remove it.
Objectpop()
Return element on top of heap and remove it.

Method Detail

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: ClassCastException 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: java.util.NoSuchElementException if isEmpty() == true

pop

public Object pop()
Return element on top of heap and remove it.

Returns: the element at top of heap

Throws: java.util.NoSuchElementException if isEmpty() == true

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