PATH |
NSMutableSet
- Inherits from:
- NSSet : Object
- Implements:
- Cloneable
- java.io.Serializable
- NSCoding
- Package:
- com.webobjects.foundation
Class Description
The NSMutableSet class declares the programmatic interface to an object that manages a mutable set of objects. NSMutableSet provides support for the mathematical concept of a set. A set, both in its mathematical sense, and in the NSMutableSet implementation, is an unordered collection of distinct elements. The NSSet class supports creating and managing immutable sets.
Table 0-11 describes the NSMutableSet methods that provide the basis for all NSMutableSet's other methods; that is, all other methods are implemented in terms of these five. If you create a subclass of NSMutableSet, you need only ensure that these base methods work properly. Having done so, you can be sure that all your subclass's inherited methods operate properly.
Method | Description |
count | Returns the number of members in the set. |
member | Returns the object in the set that is equal to the specified object. |
objectsNoCopy | Returns the actual array of objects in the set. |
removeAllObjects | Empties the set of all its members. |
removeObject | Removes the specified object from the set. |
Objects are removed from an NSMutableSet using any of the methods intersectSet, removeAllObjects, removeObject, or subtractSet.
Objects are added to an NSMutableSet with addObject, which adds a single object to the set; addObjectsFromArray, which adds all objects from a specified array to the set; or with unionSet, which adds all the objects from another set.
Methods that add entries to NSMutableSets-whether during construction or modification-add each member to the set directly. This means that you must ensure that the members do not change. If you expect your members to change for any reason, you should make copies of them and add the copies to the set.
Interfaces Implemented
- Cloneable
- clone
- java.io.Serializable
- NSCoding
- classForCoder
- decodeObject
- encodeWithCoder
Method Types
- Constructors
- NSMutableSet
- Adding and removing entries
- addObject
- addObjectsFromArray
- removeAllObjects
- removeObject
- Combining and recombining sets
- intersectSet
- setSet
- subtractSet
- unionSet
- Copying the set
- immutableClone
Constructors
NSMutableSet
public NSMutableSet()
public NSMutableSet(NSArray anArray)
Note: NSMutableSet assumes that member objects are immutable. If your member objects are mutable, you should make copies of them and add the copies to the set. |
public NSMutableSet(NSSet aSet)
public NSMutableSet(Object anObject)
Note: NSMutableSet assumes that member objects are immutable. If your member objects are mutable, you should make copies of them and add the copies to the set. |
public NSMutableSet(Object[] objects[])
Note: NSMutableSet assumes that member objects are immutable. If your member objects are mutable, you should make copies of them and add the copies to the set. |
public NSMutableSet(int capacity)
Instance Methods
addObject
public void addObject(Object anObject)
Note: NSMutableSet assumes that member objects are immutable. If your member objects are mutable, you should make copies of them and add the copies to the set. |
See Also: addObjectsFromArray, unionSet
addObjectsFromArray
public void addObjectsFromArray(NSArray anArray)
Note: NSMutableSet assumes that member objects are immutable. If your member objects are mutable, you should make copies of them and add the copies to the set. |
clone
public Object clone()
immutableClone
public NSSet immutableClone()
intersectSet
public void intersectSet(NSSet otherSet)
See Also: removeObject, removeAllObjects, subtractSet
mutableClone
public NSMutableArray mutableClone()
removeAllObjects
public void removeAllObjects()
See Also: removeObject, intersectSet, subtractSet
removeObject
public void removeObject(Object anObject)
See Also: removeAllObjects, intersectSet, subtractSet
setSet
public void setSet(NSSet otherSet)
subtractSet
public void subtractSet(NSSet otherSet)
See Also: removeObject, removeAllObjects, intersectSet
unionSet
public void unionSet(NSSet otherSet)
See Also: addObject, addObjectsFromArray
© 2001 Apple Computer, Inc. (Last Published April 17, 2001)