NSCountedSet
, a subclass of NSMutableSet
, is a set to which you can add a particular object more than once; in other words, the elements of the set aren’t necessarily distinct. A counted set is also known as a bag. The NSCountedSet
class is available only in Objective-C.
Each distinct object inserted into an NSCountedSet
object has a counter associated with it. NSCountedSet
keeps track of the number of times objects are inserted and requires that objects be removed the same number of times. Thus, there is only one instance of an object in an NSCountedSet
even if the object has been added to the set multiple times. The countForObject:
method returns the number of times the specified object has been added to this set.
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-02-04)