Instance Method


Evaluates a given predicate against the set’s content and removes from the set those objects for which the predicate returns false.


- (void)filterUsingPredicate:(NSPredicate *)predicate;



A predicate.


The following example illustrates the use of this method.

NSMutableSet *mutableSet =
    [NSMutableSet setWithObjects:@"One", @"Two", @"Three", @"Four", nil];
NSPredicate *predicate =
    [NSPredicate predicateWithFormat:@"SELF beginswith 'T'"];
[mutableSet filterUsingPredicate:predicate];
// mutableSet contains (Two, Three)

See Also

Adding and removing entries

- addObject:

Adds a given object to the set, if it is not already a member.

- removeObject:

Removes a given object from the set.

- removeAllObjects

Empties the set of all of its members.

- addObjectsFromArray:

Adds to the set each object contained in a given array that is not already a member.