### Question:
PriorityDelayQueue extends AbstractQueue<PriorityDelayQueue.QueueElement<E>> implements BlockingQueue<PriorityDelayQueue.QueueElement<E>> { @Override public void clear() { for (DelayQueue<QueueElement<E>> q : queues) { q.clear(); } } @SuppressWarnings("unchecked")  PriorityDelayQueue(int priorities, long maxWait, TimeUnit unit, int maxSize); int getPriorities(); long getMaxWait(TimeUnit unit); long getMaxSize(); @Override @SuppressWarnings("unchecked") Iterator<QueueElement<E>> iterator(); @Override int size(); int[] sizes(); @Override boolean add(QueueElement<E> queueElement); @Override boolean offer(QueueElement<E> queueElement); @Override QueueElement<E> poll(); @Override QueueElement<E> peek(); @Override void put(QueueElement<E> e); @Override boolean offer(QueueElement<E> e, long timeout, TimeUnit unit); @Override QueueElement<E> take(); @Override QueueElement<E> poll(long timeout, TimeUnit unit); @Override int remainingCapacity(); @Override int drainTo(Collection<? super QueueElement<E>> c); @Override int drainTo(Collection<? super QueueElement<E>> c, int maxElements); @Override void clear(); static final long ANTI_STARVATION_INTERVAL; }### Answer:
@Test public void testClear() { PriorityDelayQueue<Integer> q = new PriorityDelayQueue<Integer>(3, 500, TimeUnit.MILLISECONDS, -1); q.offer(new TestQueueElement<Integer>(1, 1, 10, TimeUnit.MILLISECONDS)); q.offer(new TestQueueElement<Integer>(10, 0, 0, TimeUnit.MILLISECONDS)); assertEquals(2, q.size()); q.clear(); assertEquals(0, q.size()); }