Code example for ArrayList

Methods: remove, toArray

0
        list.addAll(0, collection); 
        assertEquals(14, list.size()); 
    } 
 
    public void test_removeLjava_lang_Object() { 
        List list = new ArrayList(Arrays.asList(new String[] { "a", "b", "c", 
                "d", "e", "f", "g" })); 
        assertTrue("Removed wrong element 1", list.remove("a")); 
        assertTrue("Removed wrong element 2", list.remove("f")); 
        String[] result = new String[5]; 
        list.toArray(result); 
        assertTrue("Removed wrong element 3", Arrays.equals(result, 
                new String[] { "b", "c", "d", "e", "g" })); 
    } 
 
    class Mock_ArrayList extends ArrayList { 
        public Mock_ArrayList() { 
        } 
 
        public void removeRange(int begin, int end) { 
            super.removeRange(begin, end);