User's Guide to the GNU Objective-C Class Library
9.1 Basic Adding
Adding, adding if absent, adding a copy, adding all contents of another
collection, adding contents if absent, adding with varargs.
- Method: Collection @keyword{-addObject:} newObject
- @deftypemethodx Collection {} @keyword{-addElement:} (elt)newElement
Adds newObject to the receiving collection. Returns self.
- Method: Collection @keyword{-addObjectIfAbsent:} newObject
- @deftypemethodx Collection {} @keyword{-addElementIfAbsent:} (elt)newElement
Adds newObject to the receiving collection only if newObject
isn't there already. Returns self.
- Method: Collection @keyword{-addContentsOf:} (id <Collecting>)newObject
- Adds all the elements in aCollection to the receiving collection.
Returns self.
- Method: Collection @keyword{-addContentsOfIfAbsent:} (id <Collecting>)newObject
- <<Undocumented>> Returns self.
- Method: Collection @keyword{-addObjectsCount:} (unsigned)count, ...
- @deftypemethodx Collection {} @keyword{-addElementsCount:} (unsigned)count, ...
<<Undocumented>> Returns self.
Here is an example
| | id o1 = [[Foo alloc] init];
id o2 = [[Bar alloc] init];
id myArray = [[[Array alloc] init] addObjectsCount: 2, o1, o2];
|