(Preliminary Documentation) Copyright ã1994 by NeXT Computer, Inc.  All Rights Reserved.

NSArray 

Inherits From:	NSObject 

Conforms To:	NSCoding
NSCopying  
NSMutableCopying 
NSObject 

Declared In:	foundation/NSArray.h 

Allocating and Initializing an Array

+ (id)allocWithZone:(NSZone *)zone	Creates and returns an uninitialized array object in zone.
+ (id)array	Creates and returns an empty array object
+ (id)arrayWithObject:(id)anObject	Creates and returns an array object containing the single element anObject.
+ (id)arrayWithObjects:(id)firstObj,...	Creates and returns an array object containing the objects in the argument list. The object list is comma-separated and ends with nil.
- (id)initWithArray:(NSArray *)array	Initializes a newly allocated array object by placing in it the objects contained in anotherArray.
- (id)initWithObjects:(id)firstObj,...	Initializes a newly allocated array object by placing in it the objects in the argument list.  The object list is comma-separated and ends with nil.
- (id)initWithObjects:(id *)objects	Initializes a newly allocated array object by placing in 
count:(unsigned int)count		it count objects from the objects array

Querying the Array

- (BOOL)containsObject:(id)candidate	Returns YES if anObject is present in the array.
- (unsigned int)count	Returns the number of objects currently in the array.
- (unsigned int)indexOfObject:(id)anObject	Returns the index of anObject, if found; otherwise, returns NSNotFound.  This method checks the elements in the array from last to first by sending them an isEqual: message.
- (unsigned int)indexOfObjectIdenticalTo:(id)anObject	
	Returns the index of anObject, if found; otherwise, returns NSNotFound.  This method checks the elements in the array from last to first by comparing their ids.
- (id)lastObject	Returns the last object in the array.
- (id)objectAtIndex:(unsigned int)index	Returns the object located at index.  An array's index starts at 0.  If index is beyond the end of the array, an NSRangeException error is raised.
- (NSEnumerator *)objectEnumerator	Returns an enumerator object that lets you access each object in the array, starting with the first element.
- (NSEnumerator *)reverseObjectEnumerator	Returns an enumerator object that lets you access each object in the array, from the last element to the first.

Sending Messages to Elements

- (void)makeObjectsPerform:(SEL)aSelector	Sends an aSelector message to each object in the array.
- (void)makeObjectsPerform:(SEL)aSelector	Sends an aSelector message to each object in the 
withObject:(id)anObject		array, with anObject as an argument.

Comparing Arrays

- (id)firstObjectCommonWithArray:(NSArray *)otherArray
	Returns the first object from the receiver's array that's equal to an object in otherArray.
- (BOOL)isEqualToArray:(NSArray *)otherArray	Compares the receiving array object to otherArray.  

Deriving New Arrays

- (NSArray *)sortedArrayUsingFunction:(int(*)(id element1, id element2, void *userData))comparator	
context:(void *)context	Returns an array listing the receiver's elements in ascending order as defined by the comparison function comparator.   context is passed to the comparator function as its third argument.
- (NSArray *)sortedArrayUsingSelector:(SEL)comparator	
	Returns an array listing the receiver's elements in ascending order, as determined by the comparison method specified by the selector comparator.
- (NSArray *)subarrayWithRange:(NSRange)range	Returns an array containing the receiver's elements that fall within the limits specified by range.

Joining String Elements

- (NSString *)componentsJoinedByString:(NSString *)separator	
	Returns a string that's the result of interposing separator between the elements of the receiver's array.

Creating a String Description of the Array

- (NSString *)description	Returns a string object that represents the contents of the receiver.
- (NSString *)descriptionWithLocale:(NSDictionary *)localeDictionary
	Returns a string representation of the NSArray object.  Included are the key and values that represent the locale data from localeDictionary.
- (NSString *)descriptionWithLocale:(NSDictionary *)localeDictionary
indent:(unsigned int)level	Returns a string representation of the NSArray object.  Included are the key and values that represent the locale data from localeDictionary.  Elements of the array are indented from the left margin by level + 1 multiples of four spaces, to make the output more readable.