Package org.apache.commons.collections

Examples of org.apache.commons.collections.ResettableListIterator


             e.getClass().equals((new NoSuchElementException()).getClass()));
        }
    }
   
    public void testReset() {
        ResettableListIterator it = (ResettableListIterator) makeObject();
       
        assertEquals(true, it.hasNext());
        assertEquals(false, it.hasPrevious());
        assertEquals(testValue, it.next());
        assertEquals(false, it.hasNext());
        assertEquals(true, it.hasPrevious());

        it.reset();
       
        assertEquals(true, it.hasNext());
        assertEquals(false, it.hasPrevious());
        assertEquals(testValue, it.next());
        assertEquals(false, it.hasNext());
        assertEquals(true, it.hasPrevious());
       
        it.reset();
        it.reset();
       
        assertEquals(true, it.hasNext());
    }
View Full Code Here


        assertEquals("Three", it.previous());
        assertEquals("Four", it.previous());
    }

    public void testReset() {
        ResettableListIterator it = (ResettableListIterator) makeFullListIterator();
        assertEquals("Four", it.next());
        it.reset();
        assertEquals("Four", it.next());
        it.next();
        it.next();
        it.reset();
        assertEquals("Four", it.next());
    }
View Full Code Here

             e.getClass().equals((new NoSuchElementException()).getClass()));
        }
    }
   
    public void testReset() {
        ResettableListIterator it = (ResettableListIterator) makeObject();
       
        assertEquals(true, it.hasNext());
        assertEquals(false, it.hasPrevious());
        assertEquals(testValue, it.next());
        assertEquals(false, it.hasNext());
        assertEquals(true, it.hasPrevious());

        it.reset();
       
        assertEquals(true, it.hasNext());
        assertEquals(false, it.hasPrevious());
        assertEquals(testValue, it.next());
        assertEquals(false, it.hasNext());
        assertEquals(true, it.hasPrevious());
       
        it.reset();
        it.reset();
       
        assertEquals(true, it.hasNext());
    }
View Full Code Here

        }

    }

    public void testReset() {
        ResettableListIterator iter = (ResettableListIterator) makeFullIterator();
        Object first = iter.next();
        Object second = iter.next();
       
        iter.reset();
       
        // after reset, there shouldn't be any previous elements
        assertFalse("No previous elements after reset()", iter.hasPrevious());

        // after reset, the results should be the same as before
        assertEquals("First element should be the same", first, iter.next());
        assertEquals("Second elment should be the same", second, iter.next());
       
        // after passing the point, where we resetted, continuation should work as expected
        for (int i = 2; i < testArray.length; i++) {
            Object testValue = testArray[i];
            Object iterValue = iter.next();

            assertEquals("Iteration value is correct", testValue, iterValue);
        }
    }
View Full Code Here

             e.getClass().equals((new NoSuchElementException()).getClass()));
        }
    }
   
    public void testReset() {
        ResettableListIterator it = (ResettableListIterator) makeObject();
       
        assertEquals(true, it.hasNext());
        assertEquals(false, it.hasPrevious());
        assertEquals(testValue, it.next());
        assertEquals(false, it.hasNext());
        assertEquals(true, it.hasPrevious());

        it.reset();
       
        assertEquals(true, it.hasNext());
        assertEquals(false, it.hasPrevious());
        assertEquals(testValue, it.next());
        assertEquals(false, it.hasNext());
        assertEquals(true, it.hasPrevious());
       
        it.reset();
        it.reset();
       
        assertEquals(true, it.hasNext());
    }
View Full Code Here

        }

    }

    public void testReset() {
        ResettableListIterator iter = (ResettableListIterator) makeFullIterator();
        Object first = iter.next();
        Object second = iter.next();
       
        iter.reset();
       
        // after reset, there shouldn't be any previous elements
        assertFalse("No previous elements after reset()", iter.hasPrevious());

        // after reset, the results should be the same as before
        assertEquals("First element should be the same", first, iter.next());
        assertEquals("Second elment should be the same", second, iter.next());
       
        // after passing the point, where we resetted, continuation should work as expected
        for (int i = 2; i < testArray.length; i++) {
            Object testValue = testArray[i];
            Object iterValue = iter.next();

            assertEquals("Iteration value is correct", testValue, iterValue);
        }
    }
View Full Code Here

             e.getClass().equals((new NoSuchElementException()).getClass()));
        }
    }
   
    public void testReset() {
        ResettableListIterator it = (ResettableListIterator) makeObject();
       
        assertEquals(true, it.hasNext());
        assertEquals(false, it.hasPrevious());
        assertEquals(testValue, it.next());
        assertEquals(false, it.hasNext());
        assertEquals(true, it.hasPrevious());

        it.reset();
       
        assertEquals(true, it.hasNext());
        assertEquals(false, it.hasPrevious());
        assertEquals(testValue, it.next());
        assertEquals(false, it.hasNext());
        assertEquals(true, it.hasPrevious());
       
        it.reset();
        it.reset();
       
        assertEquals(true, it.hasNext());
    }
View Full Code Here

        assertEquals("Three", it.previous());
        assertEquals("Four", it.previous());
    }

    public void testReset() {
        ResettableListIterator it = (ResettableListIterator) makeFullListIterator();
        assertEquals("Four", it.next());
        it.reset();
        assertEquals("Four", it.next());
        it.next();
        it.next();
        it.reset();
        assertEquals("Four", it.next());
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.ResettableListIterator

Copyright © 2018 www.massapicom. 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.