1 16 package org.apache.commons.collections; 17 18 import java.util.NoSuchElementException ; 19 20 32 public final class SynchronizedPriorityQueue implements PriorityQueue { 33 34 37 protected final PriorityQueue m_priorityQueue; 38 39 44 public SynchronizedPriorityQueue(final PriorityQueue priorityQueue) { 45 m_priorityQueue = priorityQueue; 46 } 47 48 51 public synchronized void clear() { 52 m_priorityQueue.clear(); 53 } 54 55 60 public synchronized boolean isEmpty() { 61 return m_priorityQueue.isEmpty(); 62 } 63 64 69 public synchronized void insert(final Object element) { 70 m_priorityQueue.insert(element); 71 } 72 73 79 public synchronized Object peek() throws NoSuchElementException { 80 return m_priorityQueue.peek(); 81 } 82 83 89 public synchronized Object pop() throws NoSuchElementException { 90 return m_priorityQueue.pop(); 91 } 92 93 98 public synchronized String toString() { 99 return m_priorityQueue.toString(); 100 } 101 102 } 103 | Popular Tags |