Replaces the element at the specified location in this ArrayList with the specified object. @param location the index at which to put the specified object. @param object the object to add. @return the previous element at the index. @throws IndexOutOfBoundsException
(int location, E object)
| 600 | * when {@code location < 0 || >= size()} |
| 601 | */ |
| 602 | @Override |
| 603 | public E set(int location, E object) { |
| 604 | if (location < 0 || location >= size) { |
| 605 | throw new IndexOutOfBoundsException( |
| 606 | // luni.0A=Index: {0}, Size: {1} |
| 607 | Messages.getString("luni.0A", //$NON-NLS-1$ |
| 608 | Integer.valueOf(location), |
| 609 | Integer.valueOf(size))); |
| 610 | } |
| 611 | E result = array[firstIndex + location]; |
| 612 | array[firstIndex + location] = object; |
| 613 | return result; |
| 614 | } |
| 615 | |
| 616 | /** |
| 617 | * Returns the number of elements in this {@code ArrayList}. |