Code example for ArrayList

Methods: isEmpty

     * 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() 
        assertTrue("Returned true for existing list with elements", !alist 
     * 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 
Experience pair programming with AI  Get Codota for Java