public List<T> toList() {
        List<T> result = new LinkedList<>();
        for (int i = 0; i < size; i++) {
            result.add((T) elements[i]);
        }
        return result;
    }
@Test
    void testOfferEmpty() {
        FixedSizePriorityQueue<Integer> queue = new FixedSizePriorityQueue<>(10, Comparator.<Integer>naturalOrder());
        List<Integer> list = queue.toList();
        assertTrue(list.isEmpty());
    }