/** * Moves the contents of another stack into this one, * but only up to the limit of this stack. If the source stack * contains more objects than free positions in this stack, then objects * will be lost. * * @param os The object stack to copy from. This stack will be cleared. */ void copy(ObjectStack os) { int len = stack.length - count; if (len > os.count) { len = os.count; } if (len > 0) { System.arraycopy(os.stack, os.count - len, stack, count, len); count += len; } os.clear(); }