public final class

SynchronizedPriorityQueue

extends Object
implements PriorityQueue
java.lang.Object
   ↳ org.apache.commons.collections.SynchronizedPriorityQueue

This class is deprecated.
PriorityQueue is replaced by the Buffer interface, see buffer subpackage. Due to be removed in v4.0.

Class Overview

A thread safe version of the PriorityQueue. Provides synchronized wrapper methods for all the methods defined in the PriorityQueue interface.

Summary

Fields
protected final PriorityQueue m_priorityQueue The underlying priority queue.
Public Constructors
SynchronizedPriorityQueue(PriorityQueue priorityQueue)
Constructs a new synchronized priority queue.
Public Methods
synchronized void clear()
Clear all elements from queue.
synchronized void insert(Object element)
Insert an element into queue.
synchronized boolean isEmpty()
Test if queue is empty.
synchronized Object peek()
Return element on top of heap but don't remove it.
synchronized Object pop()
Return element on top of heap and remove it.
synchronized String toString()
Returns a string representation of the underlying queue.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.commons.collections.PriorityQueue

Fields

protected final PriorityQueue m_priorityQueue

The underlying priority queue.

Public Constructors

public SynchronizedPriorityQueue (PriorityQueue priorityQueue)

Constructs a new synchronized priority queue.

Parameters
priorityQueue the priority queue to synchronize

Public Methods

public synchronized void clear ()

Clear all elements from queue.

public synchronized void insert (Object element)

Insert an element into queue.

Parameters
element the element to be inserted

public synchronized boolean isEmpty ()

Test if queue is empty.

Returns
  • true if queue is empty else false.

public synchronized 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 synchronized Object pop ()

Return element on top of heap and remove it.

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

public synchronized String toString ()

Returns a string representation of the underlying queue.

Returns
  • a string representation of the underlying queue