code: public void clear() {
      // clean up references in the array for memory management
      for(int i = 0; i < size; i++) {
        queue[i] = null;
      }
      this.size = 0;
      heapModified();
    }
docs: Clear the heap.