PATH  Documentation > Mac OS X > Foundation Reference: Java



Table of Contents

NSMutableSet


Inherits from:
NSSet : NSObject
Package:
com.apple.yellow.foundation

Class at a Glance


An NSMutableSet object stores a modifiable set of objects.

Principal Attributes


Creation



NSMutableSet: Creates a new set

Commonly Used Methods



addObject: Adds an object to the set, if it isn't already a member.
removeObject: Removes an object from the set.

Primitive Methods



addObject: Adds an object to the set, if it isn't already a member.
removeObject: Removes an object from the set.




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.

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.




Method Types


Constructors
NSMutableSet
Adding and removing entries
addObject
removeObject
removeAllObjects
addObjectsFromArray
Combining and recombining sets
unionSet
subtractSet
intersectSet
setSet


Constructors



NSMutableSet

public NSMutableSet()

Returns an empty mutable set.

public NSMutableSet(NSSet aSet)

Returns a mutable set containing those objects contained within the set aSet.




Instance Methods



addObject

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



addObjectsFromArray

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.

See Also: addObject, unionSet



intersectSet

public void intersectSet(NSSet otherSet)

Removes from the receiver each object that isn't a member of otherSet.

See Also: removeObject, removeAllObjects, subtractSet



removeAllObjects

public void removeAllObjects()

Empties the set of all of its members.

See Also: removeObject, subtractSet, intersectSet



removeObject

public void removeObject(Object anObject)

Removes anObject from the set.

See Also: removeObject, subtractSet, intersectSet



setSet

public void setSet(NSSet otherSet)

Empties the receiver, then adds each object contained in otherSet to the receiver



subtractSet

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



unionSet

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




Table of Contents