public boolean remove(@Nonnull T toRemove) {
        final int elementIndex = toRemove.getInternalIndex();
        removeInternal(elementIndex);
        return elementIndex == getHeadElementIndex();
    }
@Test
    void testRemove() {
        HeapPriorityQueue<TestElement> priorityQueue = newPriorityQueue(1);

        final long key = 4711L;
        final long priorityValue = 42L;
        final TestElement testElement = new TestElement(key, priorityValue);

        assertThat(priorityQueue.add(testElement)).isTrue();
        assertThat(priorityQueue.remove(testElement)).isTrue();
        assertThat(priorityQueue.isEmpty()).isTrue();
    }