add missing classpath methods

This commit is contained in:
Joel Dice 2007-11-14 09:32:36 -07:00
parent d1048f9bcb
commit 69f1024887
5 changed files with 19 additions and 2 deletions

View File

@ -2,7 +2,7 @@ package java.lang;
import java.lang.reflect.Method;
public abstract class Enum<E extends Enum<E>> {
public abstract class Enum<E extends Enum<E>> implements Comparable<E> {
private final String name;
private final int ordinal;

View File

@ -42,6 +42,10 @@ public class Arrays {
return array[index];
}
public T set(int index, T value) {
throw new UnsupportedOperationException();
}
public <S> S[] toArray(S[] a) {
return (S[])array;
}

View File

@ -114,7 +114,7 @@ public class LinkedList<T> implements List<T> {
addFirst(element);
} else {
Cell<T> cell = find(index);
Cell<T> newCell = new Cell<T>(element, cell.prev, cell);
Cell<T> newCell = new Cell(element, cell.prev, cell);
cell.prev.next = newCell;
}
}
@ -131,6 +131,13 @@ public class LinkedList<T> implements List<T> {
return find(index).value;
}
public T set(int index, T value) {
Cell<T> c = find(index);
T old = c.value;
c.value = value;
return old;
}
public T getFirst() {
if (front != null) {
return front.value;

View File

@ -3,6 +3,8 @@ package java.util;
public interface List<T> extends Collection<T> {
public T get(int index);
public T set(int index, T value);
public T remove(int index);
public boolean add(T element);

View File

@ -42,6 +42,10 @@ public class Vector<T> implements List<T> {
return list.get(index);
}
public synchronized T set(int index, T value) {
return list.set(index, value);
}
public T elementAt(int index) {
return get(index);
}