class LookupPriorityQueue extends PriorityQueue<LookupResultItem> {

    private final int maxSize;

    LookupPriorityQueue(final int maxSize) {
        super(maxSize);
        this.maxSize = maxSize;
    }

    /** {@inheritDoc} */
    @Override
    protected boolean lessThan(final LookupResultItem item1, final LookupResultItem item2) {
        return item1.getScore() < item2.getScore();
    }

    /**
     * Transforms queue values into list sorted from highest scores to the lowest.
     * @return list of the values
     */
    List<LookupResultItem> getResult() {<FILL_FUNCTION_BODY>}

    /**
     * Determines whether element with {@code score} would be inserted into this queue.
     * @param score score of the element to insert
     * @return {@code true} if the element would be inserted. {@code false} otherwise.
     */
    boolean canInsert(final long score) {
        if (size() < maxSize) {
            return true;
        }
        return size() > 0 && score >= top().getScore();
    }

}

        int size = this.size();
        LookupResultItem[] res = new LookupResultItem[size];

        for (int i = size - 1; i >= 0; i--) { // iterate from top so results are ordered in descending order
            res[i] = this.pop();
        }

        return Arrays.asList(res);
    
<no_super_class>