code: public T insertWithOverflow(T element) {
      if (size < maxSize) {
        add(element);
        return null;
      } else if (size > 0 && !lessThan(element, heap[1])) {
        T ret = heap[1];
        heap[1] = element;
        updateTop();
        return ret;
      } else {
        return element;
      }
    }
docs: Adds an Object to a PriorityQueue in log(size) time.
  It returns the object (if any) that was
  dropped off the heap because it was full. This can be
  the given parameter (in case it is smaller than the
  full heap's minimum, and couldn't be added), or another
  object that was previously the smallest value in the
  heap and now has been replaced by a larger one, or null
  if the queue wasn't yet full with maxSize elements.