Name
NSCountedSet — Mac OS X 10.0
Synopsis
This class extends the functionality of
NSMutableSet by associating with each member of
the set a count of how many times the object has been added to the
set. By keeping a count with each object,
NSCountedSet essentially removes the restriction
that every member of a set must be unique.
NSCountedSet reimplements several of
NSMutableSet’s methods to support
the object counter. The one new method in
NSCountedSet is
countForObject:, which will return the counter
value for the specified object. If the object is not a member of the
set, this method returns 0. This count can be
viewed as the number of occurences of the object within the set.
|
![]()
|
@interface NSCountedSet : NSMutableSet
|
// Initializers
|
- (id)initWithArray:(NSArray *)array; |
- (id)initWithCapacity:(unsigned)numItems; |
- (id)initWithSet:(NSSet *)set; |
// Instance Methods
|
- (void)addObject:(id)object; |
- (unsigned)countForObject:(id)object; |
- (NSEnumerator *)objectEnumerator;
|
- (void)removeObject:(id)object; |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
