Examples of NSMutableArray


Examples of org.rococoa.cocoa.foundation.NSMutableArray

import org.rococoa.test.RococoaTestCase;

public class NSMutableArrayTest extends RococoaTestCase {

    @Test public void test() {
        NSMutableArray array = NSMutableArray.CLASS.arrayWithCapacity(3);
        assertEquals(0, array.count());
        array.addObject(NSString.stringWithString("Hello"));
        array.addObject("Goodbye");
        assertEquals(2, array.count());
        assertEquals("(\n    Hello,\n    Goodbye\n)", array.description());
       
        NSObject first = array.objectAtIndex(0);
        assertEquals(NSString.stringWithString("Hello"), first);
       
        NSString firstAsString = Rococoa.cast(first, NSString.class);
        assertEquals("Hello", firstAsString.toString());
        assertEquals("Goodbye",
                Rococoa.cast(array.objectAtIndex(1), NSString.class).toString());
    }  
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.