public void testReverse() {
    // Reverse the list.

    if (list.size() > 1) {
      ListIterator back = list.listIterator(numElements);
      ListIterator front = list.listIterator();

      for (int i = 0; i < list.size() / 2; i++) {
        Object frontOjb = front.next(), backObj = back.previous();
        front.set(backObj);
        back.set(frontOjb);
      }

      assertEquals(list.size(), numElements);
      for (int i = 0; i < numElements; i++) assertTrue(list.get(i).equals(numElements - 1 - i));
    }
  }
  public void testSet() {

    // Double the values in the list using set

    iter = list.listIterator();

    while (iter.hasNext()) {
      int next = (Integer) iter.next();
      next *= 2;
      iter.set(next);
    }

    // Check if the doubling got done right

    assertEquals(list.size(), numElements);
    for (int i = 0; i < numElements; i++) assertTrue(list.get(i).equals(2 * i));
  }