Added ArrayList.set

This commit is contained in:
Eric Scharff
2007-09-26 10:02:58 -06:00
parent 7d67d09b1a
commit 0f926f8f0b

View File

@ -100,6 +100,15 @@ public class ArrayList<T> implements List<T> {
} }
} }
public T set(int index, T element) {
if (index >= size) {
resize(index+1);
}
Object oldValue = array[index];
array[index] = element;
return (T) oldValue;
}
public T remove(int index) { public T remove(int index) {
T v = get(index); T v = get(index);