package class1_2_ArrayList_021; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; public class ArrayList implements List { private E[] array = (E[]) new Object[0]; /** * Appends the specified element to the end of this list (optional * operation). *

*

Lists that support this operation may place limitations on what * elements may be added to this list. In particular, some * lists will refuse to add null elements, and others will impose * restrictions on the type of elements that may be added. List * classes should clearly specify in their documentation any restrictions * on what elements may be added. * * @param e element to be appended to this list * @return true (as specified by {@link Collection#add}) * @throws UnsupportedOperationException if the add operation * is not supported by this list * @throws ClassCastException if the class of the specified element * prevents it from being added to this list * @throws NullPointerException if the specified element is null and this * list does not permit null elements * @throws IllegalArgumentException if some property of this element * prevents it from being added to this list */ @Override public boolean add(E e) { E[] newArray = (E[]) new Object[array.length+1]; for(int i = 0; iremove operation * is not supported by this list * @throws IndexOutOfBoundsException if the index is out of range * (index < 0 || index >= size()) */ @Override public E remove(int index) { throw new UnsupportedOperationException("This method isn't written yet."); } //------- NOT IMPLEMENTED ---- @Override public int size() { return 0; } @Override public boolean isEmpty() { return false; } @Override public boolean contains(Object o) { return false; } @Override public Iterator iterator() { return null; } @Override public Object[] toArray() { return new Object[0]; } @Override public T[] toArray(T[] a) { return null; } @Override public boolean remove(Object o) { return false; } @Override public boolean containsAll(Collection c) { return false; } @Override public boolean addAll(Collection c) { return false; } @Override public boolean addAll(int index, Collection c) { return false; } @Override public boolean removeAll(Collection c) { return false; } @Override public boolean retainAll(Collection c) { return false; } @Override public void clear() { } @Override public E get(int index) { return null; } @Override public E set(int index, E element) { return null; } @Override public void add(int index, E element) { } @Override public int indexOf(Object o) { return 0; } @Override public int lastIndexOf(Object o) { return 0; } @Override public ListIterator listIterator() { return null; } @Override public ListIterator listIterator(int index) { return null; } @Override public List subList(int fromIndex, int toIndex) { return null; } }