Package java.util

Examples of java.util.ListIterator.previousIndex()


        walkBackward(expected,testing);

        // forward,back,forward
        while(expected.hasNext()) {
            assertEquals(expected.nextIndex(),testing.nextIndex());
            assertEquals(expected.previousIndex(),testing.previousIndex());
            assertTrue(testing.hasNext());
            assertEquals(expected.next(),testing.next());
            assertTrue(testing.hasPrevious());
            assertEquals(expected.previous(),testing.previous());
            assertTrue(testing.hasNext());
View Full Code Here


        for(int i=0;i<list.size();i++) {
            // walk forward i
            for(int j=0;j<i;j++) {
                assertEquals(expected.nextIndex(),testing.nextIndex());
                assertEquals(expected.previousIndex(),testing.previousIndex());
                assertTrue(expected.hasNext()); // if this one fails we've got a logic error in the test
                assertTrue(testing.hasNext());
                assertEquals(expected.next(),testing.next());
            }
            // walk back i/2
View Full Code Here

                assertEquals(expected.next(),testing.next());
            }
            // walk back i/2
            for(int j=0;j<i/2;j++) {
                assertEquals(expected.nextIndex(),testing.nextIndex());
                assertEquals(expected.previousIndex(),testing.previousIndex());
                assertTrue(expected.hasPrevious()); // if this one fails we've got a logic error in the test
                assertTrue(testing.hasPrevious());
                assertEquals(expected.previous(),testing.previous());
            }
            // walk forward i/2
View Full Code Here

                assertEquals(expected.previous(),testing.previous());
            }
            // walk forward i/2
            for(int j=0;j<i/2;j++) {
                assertEquals(expected.nextIndex(),testing.nextIndex());
                assertEquals(expected.previousIndex(),testing.previousIndex());
                assertTrue(expected.hasNext()); // if this one fails we've got a logic error in the test
                assertTrue(testing.hasNext());
                assertEquals(expected.next(),testing.next());
            }
            // walk back i
View Full Code Here

                assertEquals(expected.next(),testing.next());
            }
            // walk back i
            for(int j=0;j<i;j++) {
                assertEquals(expected.nextIndex(),testing.nextIndex());
                assertEquals(expected.previousIndex(),testing.previousIndex());
                assertTrue(expected.hasPrevious()); // if this one fails we've got a logic error in the test
                assertTrue(testing.hasPrevious());
                assertEquals(expected.previous(),testing.previous());
            }
        }
View Full Code Here

                if(expected.hasPrevious()) {
                    assertEquals(walkdescr.toString(),expected.previous(),testing.previous());
                }
            }
            assertEquals(walkdescr.toString(),expected.nextIndex(),testing.nextIndex());
            assertEquals(walkdescr.toString(),expected.previousIndex(),testing.previousIndex());
        }

    }

}
View Full Code Here

        ListIterator it = makeEmptyListIterator();
       
        assertEquals(false, it.hasNext());
        assertEquals(0, it.nextIndex());
        assertEquals(false, it.hasPrevious());
        assertEquals(-1, it.previousIndex());
       
        // next() should throw a NoSuchElementException
        try {
            it.next();
            fail("NoSuchElementException must be thrown from empty ListIterator");
View Full Code Here

        }
       
        // loop back through comparing
        for (int i = list.size() - 1; i >= 0; i--) {
            assertEquals(i + 1, it.nextIndex());
            assertEquals(i, it.previousIndex());
       
            Object obj = list.get(i);
            assertEquals(obj, it.previous());
        }
       
View Full Code Here

        // Step 2 - Go though the new list.
        if (newList != null) {
            // Step i - Gather the list info.
            ListIterator iterator = (ListIterator)iteratorFor(newList);
            while (iterator.hasNext()) {
                newListValueIndex.put(iterator.next(), new Integer(iterator.previousIndex()));
            }
       
            // Step ii - Go through the new list again.       
            int index = 0;
            int offset = 0;
View Full Code Here

        walkBackward(expected,testing);

        // forward,back,foward
        while(expected.hasNext()) {
            assertEquals(expected.nextIndex(),testing.nextIndex());
            assertEquals(expected.previousIndex(),testing.previousIndex());
            assertTrue(testing.hasNext());
            assertEquals(expected.next(),testing.next());
            assertTrue(testing.hasPrevious());
            assertEquals(expected.previous(),testing.previous());
            assertTrue(testing.hasNext());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.