StablePriorityQueue implements Queue<E> { @Override public E element() throws NoSuchElementException { try { return queue.element().object; } catch (NoSuchElementException nsee) { counter = 0; throw nsee; } } StablePriorityQueue(int initialCapacity);  StablePriorityQueue(Collection<? extends E> c);  StablePriorityQueue(int initialCapacity, Comparator<? super E> comparator); @SuppressWarnings("unchecked")  StablePriorityQueue(StablePriorityQueue<? extends E> c);  StablePriorityQueue(SortedSet<? extends E> c); @Override E element(); @Override boolean offer(E e); @Override E peek(); @Override E remove(); @Override E poll(); @SuppressWarnings({"unchecked", "rawtypes"}) Comparator<? super E> comparator(); @Override boolean add(E e); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Iterator<E> iterator(); @SuppressWarnings("unchecked") @Override Object[] toArray(); @SuppressWarnings("unchecked") @Override T[] toArray(T[] a); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> c); @Override boolean addAll(Collection<? extends E> c); @Override boolean removeAll(Collection<?> c); @Override boolean retainAll(Collection<?> c); @Override void clear();  }
@Test public void testElement() { StablePriorityQueue<Integer> instance = new StablePriorityQueue<>(1); Integer i = 10; instance.add(i); Object result = instance.element(); assertEquals(i, result); }