/** * Add several integers into the heap. * @param v values to add. */ public void add(final int ... v) { if (v == null) throw new IllegalArgumentException("the input array cannot be null"); ensureCapacity(v.length + size); for (int i : v) addWithoutCheckingCapacity(i); }
/** * Adds a new element to the heap. * * <p>The heap with grow if it runs out of capacity to hold the new element</p> * * @param v the new element. */ public void add(final int v) { // Double capacity if overflow: ensureCapacity(size + 1); addWithoutCheckingCapacity(v); }