Code example for ArrayList

Methods: isEmpty

0
    /** 
     * java.util.ArrayList#isEmpty() 
     */ 
    public void test_isEmpty() { 
        // Test for method boolean java.util.ArrayList.isEmpty() 
        assertTrue("isEmpty returned false for new list", new ArrayList() 
                .isEmpty()); 
        assertTrue("Returned true for existing list with elements", !alist 
                .isEmpty()); 
    } 
 
    /** 
     * java.util.ArrayList#lastIndexOf(java.lang.Object) 
     */ 
    public void test_lastIndexOfLjava_lang_Object() { 
        // Test for method int java.util.ArrayList.lastIndexOf(java.lang.Object) 
        alist.add(new Integer(99)); 
        assertEquals("Returned incorrect index", 
                100, alist.lastIndexOf(objArray[99])); 
        assertEquals("Returned index for invalid Object", -1, alist 
                .lastIndexOf(new Object()));