private void siftDownComparable(int i, E e) {
        Comparable<? super E> key = (Comparable<? super E>) e;
        int half = size >>> 1;
        while (i < half) {
            // Assume left child is least
            int childIdx = (i << 1) + 1;
            Object child = queue[childIdx];
            int rightIdx = childIdx + 1;
            if (rightIdx < size &&
                   ((Comparable<? super E>) child).compareTo((E) queue[rightIdx]) > 0 ) {
                child = queue[childIdx = rightIdx];
            }
            if (key.compareTo((E) child) <= 0) {
                break;
            }
            queue[i] = child;
            i = childIdx;
        }
        queue[i] = e;
    }