Package org.apache.commons.collections

Examples of org.apache.commons.collections.OrderedMapIterator


        MapIterator it = getOrderedMap().mapIterator();
        return UnmodifiableMapIterator.decorate(it);
    }

    public OrderedMapIterator orderedMapIterator() {
        OrderedMapIterator it = getOrderedMap().orderedMapIterator();
        return UnmodifiableOrderedMapIterator.decorate(it);
    }
View Full Code Here


        return inverseOrderedBidiMap();
    }
   
    //-----------------------------------------------------------------------
    public OrderedMapIterator orderedMapIterator() {
        OrderedMapIterator it = getOrderedBidiMap().orderedMapIterator();
        return UnmodifiableOrderedMapIterator.decorate(it);
    }
View Full Code Here

        return inverseSortedBidiMap();
    }
   
    //-----------------------------------------------------------------------
    public OrderedMapIterator orderedMapIterator() {
        OrderedMapIterator it = getSortedBidiMap().orderedMapIterator();
        return UnmodifiableOrderedMapIterator.decorate(it);
    }
View Full Code Here

            return;
        }

        super.testEmptyMapIterator();
       
        OrderedMapIterator it = makeEmptyOrderedMapIterator();
        Map map = getMap();
        assertEquals(false, it.hasPrevious());
        try {
            it.previous();
            fail();
        } catch (NoSuchElementException ex) {}
    }
View Full Code Here

            return;
        }

        super.testFullMapIterator();
       
        OrderedMapIterator it = makeFullOrderedMapIterator();
        Map map = getMap();
       
        assertEquals(true, it.hasNext());
        assertEquals(false, it.hasPrevious());
        Set set = new HashSet();
        while (it.hasNext()) {
            // getKey
            Object key = it.next();
            assertSame("it.next() should equals getKey()", key, it.getKey());
            assertTrue("Key must be in map",  map.containsKey(key));
            assertTrue("Key must be unique", set.add(key));
           
            // getValue
            Object value = it.getValue();
            if (isGetStructuralModify() == false) {
                assertSame("Value must be mapped to key", map.get(key), value);
            }
            assertTrue("Value must be in map",  map.containsValue(value));

            assertEquals(true, it.hasPrevious());
           
            verify();
        }
        while (it.hasPrevious()) {
            // getKey
            Object key = it.previous();
            assertSame("it.previous() should equals getKey()", key, it.getKey());
            assertTrue("Key must be in map",  map.containsKey(key));
            assertTrue("Key must be unique", set.remove(key));
           
            // getValue
            Object value = it.getValue();
            if (isGetStructuralModify() == false) {
                assertSame("Value must be mapped to key", map.get(key), value);
            }
            assertTrue("Value must be in map",  map.containsValue(value));

            assertEquals(true, it.hasNext());
           
            verify();
        }
    }
View Full Code Here

    public void testMapIteratorOrder() {
        if (supportsFullIterator() == false) {
            return;
        }

        OrderedMapIterator it = makeFullOrderedMapIterator();
        Map map = getMap();
       
        assertEquals("keySet() not consistent", new ArrayList(map.keySet()), new ArrayList(map.keySet()));
       
        Iterator it2 = map.keySet().iterator();
        assertEquals(true, it.hasNext());
        assertEquals(true, it2.hasNext());
        List list = new ArrayList();
        while (it.hasNext()) {
            Object key = it.next();
            assertEquals(it2.next(), key);
            list.add(key);
        }
        assertEquals(map.size(), list.size());
        while (it.hasPrevious()) {
            Object key = it.previous();
            assertEquals(list.get(list.size() - 1), key);
            list.remove(list.size() - 1);
        }
        assertEquals(0, list.size());
    }
View Full Code Here

    public void testOrderedMapIterator() {
        assertTrue(makeEmptyOrderedMapIterator() instanceof Unmodifiable);
    }
   
    public void testDecorateFactory() {
        OrderedMapIterator it = makeFullOrderedMapIterator();
        assertSame(it, UnmodifiableOrderedMapIterator.decorate(it));
       
        it = ((OrderedMap) getMap()).orderedMapIterator() ;
        assertTrue(it != UnmodifiableOrderedMapIterator.decorate(it));
       
View Full Code Here

    public void testOrderedMapIterator() {
        assertTrue(makeEmptyOrderedMapIterator() instanceof Unmodifiable);
    }
   
    public void testDecorateFactory() {
        OrderedMapIterator it = makeFullOrderedMapIterator();
        assertSame(it, UnmodifiableOrderedMapIterator.decorate(it));
       
        it = ((OrderedMap) getMap()).orderedMapIterator() ;
        assertTrue(it != UnmodifiableOrderedMapIterator.decorate(it));
       
View Full Code Here

        MapIterator it = getOrderedMap().mapIterator();
        return UnmodifiableMapIterator.decorate(it);
    }

    public OrderedMapIterator orderedMapIterator() {
        OrderedMapIterator it = getOrderedMap().orderedMapIterator();
        return UnmodifiableOrderedMapIterator.decorate(it);
    }
View Full Code Here

            return;
        }

        super.testEmptyMapIterator();
       
        OrderedMapIterator it = makeEmptyOrderedMapIterator();
        Map map = getMap();
        assertEquals(false, it.hasPrevious());
        try {
            it.previous();
            fail();
        } catch (NoSuchElementException ex) {}
    }
View Full Code Here

TOP

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

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.