Code example for ListIterator

Methods: add, next, remove, set

0
	public void testListIteratorRemoveBetweenOperations() { 
		Object a = new Object();
		Object b = new Object();
 
		dynamicList.add(a);
		iter.next();
		iter.add(b);
 
		try { 
			iter.remove();
			fail("should have thrown " + IllegalStateException.class);
		} 
		catch (IllegalStateException ex) {
			// expected 
		} 
 
		Object o = iter.next();
		iter.set(o);
		iter.remove();
 
		try { 
			iter.remove();
			fail("should have thrown " + IllegalStateException.class);
		} 
		catch (IllegalStateException ex) {
			// expected 
		}