protected DoubleList makeDoubleList() {
   DoubleList list = new ArrayDoubleList();
   for (double i = 0; i < 10; i++) {
     list.add(i);
   }
   return list;
 }
  private void assertListNotModifiable(DoubleList list) throws Exception {
    try {
      list.add((double) 1);
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
      // expected
    }

    try {
      list.add(1, (double) 2);
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
      // expected
    }

    try {
      list.addAll(makeDoubleList());
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
      // expected
    }

    try {
      list.addAll(1, makeDoubleList());
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
      // expected
    }

    try {
      list.removeElementAt(1);
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
      // expected
    }

    try {
      list.removeElement((double) 1);
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
      // expected
    }

    try {
      list.removeAll(makeDoubleList());
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
      // expected
    }

    try {
      list.retainAll(makeDoubleList());
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
      // expected
    }

    try {
      list.clear();
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
      // expected
    }

    try {
      list.set(1, (double) 2);
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
      // expected
    }
  }