@Test public void testSet() { List<String> list = newList(); for (int i = 0; i < 10; i++) list.add(null); list.set(0, "zero"); list.set(1, "ten"); list.set(2, "twenty"); list.set(3, "thirty"); list.set(4, "forty"); list.set(5, "fifty"); list.set(6, "sixty"); list.set(7, "seventy"); list.set(8, "eighty"); list.set(9, "ninety"); assertEquals(10, list.size()); assertEquals("zero" , list.get(0)); assertEquals("ten" , list.get(1)); assertEquals("twenty" , list.get(2)); assertEquals("thirty" , list.get(3)); assertEquals("forty" , list.get(4)); assertEquals("fifty" , list.get(5)); assertEquals("sixty" , list.get(6)); assertEquals("seventy", list.get(7)); assertEquals("eighty" , list.get(8)); assertEquals("ninety" , list.get(9)); }
public E set(int index, E val) { if (index < 0 || index >= size()) throw new IndexOutOfBoundsException(); Node<E> node = root.getNodeAt(index); E result = node.value; node.value = val; return result; }
AvlTreeList extends AbstractList<E> { public E set(int index, E val) { if (index < 0 || index >= size()) throw new IndexOutOfBoundsException(); Node<E> node = root.getNodeAt(index); E result = node.value; node.value = val; return result; } }
AvlTreeList extends AbstractList<E> { public E set(int index, E val) { if (index < 0 || index >= size()) throw new IndexOutOfBoundsException(); Node<E> node = root.getNodeAt(index); E result = node.value; node.value = val; return result; } AvlTreeList();  AvlTreeList(Collection<? extends E> coll); }
AvlTreeList extends AbstractList<E> { public E set(int index, E val) { if (index < 0 || index >= size()) throw new IndexOutOfBoundsException(); Node<E> node = root.getNodeAt(index); E result = node.value; node.value = val; return result; } AvlTreeList();  AvlTreeList(Collection<? extends E> coll); int size(); E get(int index); E set(int index, E val); void add(int index, E val); E remove(int index); @SuppressWarnings("unchecked") void clear(); Iterator<E> iterator(); }
AvlTreeList extends AbstractList<E> { public E set(int index, E val) { if (index < 0 || index >= size()) throw new IndexOutOfBoundsException(); Node<E> node = root.getNodeAt(index); E result = node.value; node.value = val; return result; } AvlTreeList();  AvlTreeList(Collection<? extends E> coll); int size(); E get(int index); E set(int index, E val); void add(int index, E val); E remove(int index); @SuppressWarnings("unchecked") void clear(); Iterator<E> iterator();  }