Methods


-addObject:
Append a new object to the end of the receiver.
-addObjectAtBeginning:
Append a new object to the end of the receiver.
-count
Returns the number of objects currently in the receiver.
-insertObject:atIndex:
Insert a new object at an arbitrary position in the receiver.
-objectAtIndex:
Returns a specified item from the receiver.
-objectEnumerator
Returns an NSEnumerator to iterate over objects in this list.
-removeFirstObject
Remove the first object in the reciever.
-removeFromIndex:
Remove an object from an arbitrary position in the receiver.
-removeLastObject
Remove the last object in the receiver.

addObject:


Append a new object to the end of the receiver.

-(void) addObject:(id) anObject;
Parameter Descriptions
anObject
The object to be inserted.
Discussion

Requires: anObject be non-nil and that the number of items in the list can be expressed by an unsigned integer.
Guarantees: anObject will be appended to the last position in the linked list. The effect is the same as performing an insertion at the last position.


addObjectAtBeginning:


Append a new object to the end of the receiver.

-(void) addObjectAtBeginning:(id) anObject;
Parameter Descriptions
anObject
The object to be inserted.
Discussion

Requires: anObject be non-nil and that the number of items in the list can be expressed by an unsigned integer.
Guarantees: anObject will be inserted at the beginning of the linked list. The effect is the same as performing an insertion at the beginning using insertObject:atIndex:.


count


Returns the number of objects currently in the receiver.

-(unsigned int) count;
Discussion

Requires: None.
Guarantees: The object count is correctly returned.


insertObject:atIndex:


Insert a new object at an arbitrary position in the receiver.

-(void) insertObject:(id) anObject atIndex:(unsigned int) insertionIndex;
Parameter Descriptions
anObject
The object to be inserted.
insertionIndex
The zero-based index at which the object is to be inserted.
Discussion

Requires: anObject be non-nil, insertionIndex is less than or equal to count and is greater than or equal to zero, and that the number of items in the list can be expressed by an unsigned integer.
Guarantees: anObject will be inserted at index insertionIndex. Objects with an index less than insertionIndex will retain their current index while those at and following this point will have their index increased by one.


objectAtIndex:


Returns a specified item from the receiver.

-(id) objectAtIndex:(unsigned int) fetchIndex;
Parameter Descriptions
fetchIndex
The index of the item to be returned.
Discussion

Requires: The index is a non-negative number that is strictly less than the number of objects in the receiver.
Guarantees: The object with the corresponding index is correctly returned.


objectEnumerator


Returns an NSEnumerator to iterate over objects in this list.

-(NSEnumerator*) objectEnumerator;
Discussion

Requires: None.
Guarantees: An NSEnumerator is returned that iterates over all objects if the list is not modified during traversal.


removeFirstObject


Remove the first object in the reciever.

-(void) removeFirstObject;
Discussion

Requires: None.
Guarantees: The object with a zero-based index of 0 is removed with all subsequent objects having their indices decremented by one. If no such object exists, nil is returned.


removeFromIndex:


Remove an object from an arbitrary position in the receiver.

-(void) removeFromIndex:(unsigned int) removalIndex;
Parameter Descriptions
removalIndex
The zero-based index at which an object is to be deleted.
Discussion

Requires: The removalIndex is a non-negative integer that is strictly less than count.
Guarantees: The object with a zero-based index of removalIndex is removed with all subsequent objects having their indices decremented by one.


removeLastObject


Remove the last object in the receiver.

-(void) removeLastObject;
Discussion

Requires: There must be at least one object on the list.
Guarantees: The last object in the list is removed. If no such object exists, nil is returned.

(Last Updated March 09, 2007)