Skip to content

NSMutableArray(GBMutableArray)

Joshua Weinberg edited this page Nov 1, 2011 · 1 revision

#NSMutableArray(GBMutableArray) Category Reference

##Overview Provides extensions to NSMutableArray for simpler handling.

##Tasks

-push:

Helper method for adding the given object to the end of the receiver.

-pop

Helper method to removing the last object from the receiver.

-peek

Helper method for looking at the last object in the receiver.

##Instance Methods

###-peek

Helper method for looking at the last object in the receiver.

- (id)peek

####Return Value Returns the last object in the receiver.

####Discussion Internally, the method sends the receiver lastObject message and returns the result. If the receiver is an empty array, nil is returned.

####Declared In NSArray+GBArray.h

###-pop

Helper method to removing the last object from the receiver.

- (id)pop

####Return Value Returns the object removed from the receiver.

####Discussion Internally the method sends the receiver removeLastObject and returns the removed object. If receiver is an empty array, exception is raised.

####Exceptions

NSException Raised if the receiver is an empty array.

####Declared In NSArray+GBArray.h

###-push:

Helper method for adding the given object to the end of the receiver.

- (void)push:(id)object

####Parameters

object The object to push to the end of the receiver.

####Discussion Internally the method sends the receiver addObject:, but using this method makes usage of array as stack more obvious.

####Declared In NSArray+GBArray.h

Clone this wiki locally