- Inherits from:
- NSSet : NSObject
- Package:
- com.apple.yellow.foundation
An NSMutableSet object stores a modifiable set of objects.
NSMutableSet: | Creates a new set |
addObject: | Adds an object to the set, if it isn't already a member. |
removeObject: | Removes an object from the set. |
addObject: | Adds an object to the set, if it isn't already a member. |
removeObject: | Removes an object from the set. |
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.
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.
Objects are removed from an NSMutableSet using any of the methods intersectSet, removeAllObjects, removeObject, or subtractSet.
- Constructors
- NSMutableSet
- Adding and removing entries
- addObject
- removeObject
- removeAllObjects
- addObjectsFromArray
- Combining and recombining sets
- unionSet
- subtractSet
- intersectSet
- setSet
public NSMutableSet()
Returns an empty mutable set.
public NSMutableSet(NSSet aSet)
Returns a mutable set containing those objects contained within the set aSet.
public void addObject(Object anObject)
Adds the specified object to the receiver if it is not already a member. If anObject is already present in the set, this method has no effect on either the set or on anObject.
See Also: addObjectsFromArray, unionSet
public void addObjectsFromArray(NSArray anArray)
Adds each object contained in anArray to the receiver, if that object is not already a member. If a given element of the array is already present in the set, this method has no effect on either the set or on the array element.
public void intersectSet(NSSet otherSet)
Removes from the receiver each object that isn't a member of otherSet.
See Also: removeObject, removeAllObjects, subtractSet
public void removeAllObjects()
Empties the set of all of its members.
See Also: removeObject, subtractSet, intersectSet
public void removeObject(Object anObject)
Removes anObject from the set.
See Also: removeObject, subtractSet, intersectSet
public void setSet(NSSet otherSet)
Empties the receiver, then adds each object contained in otherSet to the receiver
public void subtractSet(NSSet otherSet)
Removes from the receiver each object contained in otherSet that is also present in the receiver. If any member of otherSet isn't present in the receiving set, this method has no effect on either the receiver or on the otherSet member.
See Also: removeObject, removeAllObjects, intersectSet
public void unionSet(NSSet otherSet)
Adds each object contained in otherSet to the receiver, if that object is not already a member. If any member of otherSet is already present in the receiver, this method has no effect on either the receiver or on the otherSet member.
See Also: addObject, addObjectsFromArray