public interface

PriorityQueue

org.apache.commons.collections.PriorityQueue
Known Indirect Subclasses

This interface is deprecated.
Replaced by the Buffer interface and implementations in buffer subpackage. Due to be removed in v4.0.

Class Overview

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

This interface is now replaced by the Buffer interface.

Summary

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

Public Methods

public abstract void clear ()

Clear all elements from queue.

public abstract 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.

public abstract boolean isEmpty ()

Test if queue is empty.

Returns
  • true if queue is empty else false.

public abstract Object peek ()

Return element on top of heap but don't remove it.

Returns
  • the element at top of heap
Throws
NoSuchElementException if isEmpty() == true

public abstract Object pop ()

Return element on top of heap and remove it.

Returns
  • the element at top of heap
Throws
NoSuchElementException if isEmpty() == true