protected FloatList makeFloatList() {
   FloatList list = new ArrayFloatList();
   for (float i = 0; i < 10; i++) {
     list.add(i);
   }
   return list;
 }
 public final void testListIteratorNotModifiable() throws Exception {
   FloatList list = makeUnmodifiableFloatList();
   assertListIteratorNotModifiable(list.listIterator());
   assertListIteratorNotModifiable(list.subList(0, list.size() - 2).listIterator());
   assertListIteratorNotModifiable(list.listIterator(1));
   assertListIteratorNotModifiable(list.subList(0, list.size() - 2).listIterator(1));
 }
 public final void testSublistNotModifiable() throws Exception {
   FloatList list = makeUnmodifiableFloatList();
   assertListNotModifiable(list.subList(0, list.size() - 2));
 }
  private void assertListNotModifiable(FloatList list) throws Exception {
    try {
      list.add((float) 1);
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
      // expected
    }

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

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

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

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

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

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

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

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

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