Code example for ListIterator

Methods: hasNexthasPreviousnextprevious

0
		Object a = new Object();
		dynamicList.add(a);
		assertEquals(1, dynamicList.size());
 
		// go forward and back 
		assertSame(iter.next(), iter.previous());
		assertFalse(iter.hasPrevious());
		assertSame(a, iter.next());
		try { 
			iter.previous();
		} 
		catch (NoSuchElementException nsee) {
			// expected (since the previous hasPrevious returned false 
		} 
 
		assertTrue(iter.hasPrevious());
 
		assertSame(iter.previous(), iter.next());
		assertFalse(iter.hasNext());
	} 
 
	public void testListIteratorNextIndexPreviousIndex() { 
		Object a = new Object();
 
Contextual code suggestions in your IDE  Get Codota for Java