/** * Inserts element into specified index, moving elements at and above * that index up one. May not be used to insert at an index beyond the * current size (that is, insertion as a last element is legal but * no further). * * @param n {@code >= 0, <=size();} index of where to insert * @param value value to insert */ public void insert(int n, int value) { if (n > size) { throw new IndexOutOfBoundsException("n > size()"); } growIfNeeded(); System.arraycopy (values, n, values, n+1, size - n); values[n] = value; size++; sorted = sorted && (n == 0 || value > values[n-1]) && (n == (size - 1) || value < values[n+1]); }
/** * Inserts element into specified index, moving elements at and above * that index up one. May not be used to insert at an index beyond the * current size (that is, insertion as a last element is legal but * no further). * * @param n {@code >= 0, <=size();} index of where to insert * @param value value to insert */ public void insert(int n, int value) { if (n > size) { throw new IndexOutOfBoundsException("n > size()"); } growIfNeeded(); System.arraycopy (values, n, values, n+1, size - n); values[n] = value; size++; sorted = sorted && (n == 0 || value > values[n-1]) && (n == (size - 1) || value < values[n+1]); }
/** * Inserts element into specified index, moving elements at and above * that index up one. May not be used to insert at an index beyond the * current size (that is, insertion as a last element is legal but * no further). * * @param n {@code >= 0, <=size();} index of where to insert * @param value value to insert */ public void insert(int n, int value) { if (n > size) { throw new IndexOutOfBoundsException("n > size()"); } growIfNeeded(); System.arraycopy (values, n, values, n+1, size - n); values[n] = value; size++; sorted = sorted && (n == 0 || value > values[n-1]) && (n == (size - 1) || value < values[n+1]); }
/** * Inserts element into specified index, moving elements at and above * that index up one. May not be used to insert at an index beyond the * current size (that is, insertion as a last element is legal but * no further). * * @param n {@code >= 0, <=size();} index of where to insert * @param value value to insert */ public void insert(int n, int value) { if (n > size) { throw new IndexOutOfBoundsException("n > size()"); } growIfNeeded(); System.arraycopy (values, n, values, n+1, size - n); values[n] = value; size++; sorted = sorted && (n == 0 || value > values[n-1]) && (n == (size - 1) || value < values[n+1]); }
/** * Inserts element into specified index, moving elements at and above * that index up one. May not be used to insert at an index beyond the * current size (that is, insertion as a last element is legal but * no further). * * @param n {@code >= 0, <=size();} index of where to insert * @param value value to insert */ public void insert(int n, int value) { if (n > size) { throw new IndexOutOfBoundsException("n > size()"); } growIfNeeded(); System.arraycopy (values, n, values, n+1, size - n); values[n] = value; size++; sorted = sorted && (n == 0 || value > values[n-1]) && (n == (size - 1) || value < values[n+1]); }
/** * Inserts element into specified index, moving elements at and above * that index up one. May not be used to insert at an index beyond the * current size (that is, insertion as a last element is legal but * no further). * * @param n {@code >= 0, <=size();} index of where to insert * @param value value to insert */ public void insert(int n, int value) { if (n > size) { throw new IndexOutOfBoundsException("n > size()"); } growIfNeeded(); System.arraycopy (values, n, values, n+1, size - n); values[n] = value; size++; sorted = sorted && (n == 0 || value > values[n-1]) && (n == (size - 1) || value < values[n+1]); }
/** * Inserts element into specified index, moving elements at and above * that index up one. May not be used to insert at an index beyond the * current size (that is, insertion as a last element is legal but * no further). * * @param n {@code >= 0, <=size();} index of where to insert * @param value value to insert */ public void insert(int n, int value) { if (n > size) { throw new IndexOutOfBoundsException("n > size()"); } growIfNeeded(); System.arraycopy (values, n, values, n+1, size - n); values[n] = value; size++; sorted = sorted && (n == 0 || value > values[n-1]) && (n == (size - 1) || value < values[n+1]); }
/** * Inserts element into specified index, moving elements at and above * that index up one. May not be used to insert at an index beyond the * current size (that is, insertion as a last element is legal but * no further). * * @param n {@code >= 0, <=size();} index of where to insert * @param value value to insert */ public void insert(int n, int value) { if (n > size) { throw new IndexOutOfBoundsException("n > size()"); } growIfNeeded(); System.arraycopy (values, n, values, n+1, size - n); values[n] = value; size++; sorted = sorted && (n == 0 || value > values[n-1]) && (n == (size - 1) || value < values[n+1]); }
/** * Adds an element to the end of the list. This will increase the * list's capacity if necessary. * * @param value the value to add */ public void add(int value) { throwIfImmutable(); growIfNeeded(); values[size++] = value; if (sorted && (size > 1)) { sorted = (value >= values[size - 2]); } }
/** * Adds an element to the end of the list. This will increase the * list's capacity if necessary. * * @param value the value to add */ public void add(int value) { throwIfImmutable(); growIfNeeded(); values[size++] = value; if (sorted && (size > 1)) { sorted = (value >= values[size - 2]); } }
/** * Adds an element to the end of the list. This will increase the * list's capacity if necessary. * * @param value the value to add */ public void add(int value) { throwIfImmutable(); growIfNeeded(); values[size++] = value; if (sorted && (size > 1)) { sorted = (value >= values[size - 2]); } }
/** * Adds an element to the end of the list. This will increase the * list's capacity if necessary. * * @param value the value to add */ public void add(int value) { throwIfImmutable(); growIfNeeded(); values[size++] = value; if (sorted && (size > 1)) { sorted = (value >= values[size - 2]); } }
/** * Adds an element to the end of the list. This will increase the * list's capacity if necessary. * * @param value the value to add */ public void add(int value) { throwIfImmutable(); growIfNeeded(); values[size++] = value; if (sorted && (size > 1)) { sorted = (value >= values[size - 2]); } }
/** * Adds an element to the end of the list. This will increase the * list's capacity if necessary. * * @param value the value to add */ public void add(int value) { throwIfImmutable(); growIfNeeded(); values[size++] = value; if (sorted && (size > 1)) { sorted = (value >= values[size - 2]); } }
/** * Adds an element to the end of the list. This will increase the * list's capacity if necessary. * * @param value the value to add */ public void add(int value) { throwIfImmutable(); growIfNeeded(); values[size++] = value; if (sorted && (size > 1)) { sorted = (value >= values[size - 2]); } }
/** * Adds an element to the end of the list. This will increase the * list's capacity if necessary. * * @param value the value to add */ public void add(int value) { throwIfImmutable(); growIfNeeded(); values[size++] = value; if (sorted && (size > 1)) { sorted = (value >= values[size - 2]); } }