public void clear() {
        final int arrayOffset = getHeadElementIndex();
        Arrays.fill(queue, arrayOffset, arrayOffset + size, null);
        size = 0;
    }
@Test
    void testClear() {
        HeapPriorityQueue<TestElement> priorityQueueSet = newPriorityQueue(1);

        int count = 10;
        HashSet<TestElement> checkSet = new HashSet<>(count);
        insertRandomElements(priorityQueueSet, checkSet, count);
        assertThat(priorityQueueSet.size()).isEqualTo(count);
        priorityQueueSet.clear();
        assertThat(priorityQueueSet.size()).isZero();
    }