www.delorie.com/gnu/docs/libobjects/libobjects_16.html   search  
 
Buy GNU books!


User's Guide to the GNU Objective-C Class Library

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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];


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003  

Please take a moment to fill out this visitor survey
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)