NSOrderedSet Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in iOS 5.0 and later. |
| Declared in | NSKeyValueCoding.h NSKeyValueObserving.h NSOrderedSet.h |
Overview
NSOrderedSet and its subclass, NSMutableOrderedSet, declare the programmatic interfaces to an ordered collection of objects.
NSOrderedSet declares the programmatic interface for static sets of distinct objects. You establish a static set’s entries when it’s created, and thereafter the entries can’t be modified. NSMutableOrderedSet, on the other hand, declares a programmatic interface for dynamic sets of distinct objects. A dynamic—or mutable—set allows the addition and deletion of entries at any time, automatically allocating memory as needed.
You can use ordered sets as an alternative to arrays when the order of elements is important and performance in testing whether an object is contained in the set is a consideration— testing for membership of an array is slower than testing for membership of a set.
Tasks
Creating an Ordered Set
-
+ orderedSet -
+ orderedSetWithArray: -
+ orderedSetWithArray:range:copyItems: -
+ orderedSetWithObject: -
+ orderedSetWithObjects: -
+ orderedSetWithObjects:count: -
+ orderedSetWithOrderedSet: -
+ orderedSetWithOrderedSet:range:copyItems: -
+ orderedSetWithSet: -
+ orderedSetWithSet:copyItems:
Initializing an Ordered Set
-
– initWithArray: -
– initWithArray:copyItems: -
– initWithArray:range:copyItems: -
– initWithObject: -
– initWithObjects: -
– initWithObjects:count: -
– initWithOrderedSet: -
– initWithOrderedSet:copyItems: -
– initWithOrderedSet:range:copyItems: -
– initWithSet: -
– initWithSet:copyItems:
Counting Entries
Accessing Set Members
-
– containsObject: -
– enumerateObjectsAtIndexes:options:usingBlock: -
– enumerateObjectsUsingBlock: -
– enumerateObjectsWithOptions:usingBlock: -
– firstObject -
– lastObject -
– objectAtIndex: -
– objectAtIndexedSubscript: -
– objectsAtIndexes: -
– indexOfObject: -
– indexOfObject:inSortedRange:options:usingComparator: -
– indexOfObjectAtIndexes:options:passingTest: -
– indexOfObjectPassingTest: -
– indexOfObjectWithOptions:passingTest: -
– indexesOfObjectsAtIndexes:options:passingTest: -
– indexesOfObjectsPassingTest: -
– indexesOfObjectsWithOptions:passingTest: -
– objectEnumerator -
– reverseObjectEnumerator -
– reversedOrderedSet -
– getObjects:range:
Key-Value Coding Support
Key-Value Observing Support
-
– addObserver:forKeyPath:options:context: -
– removeObserver:forKeyPath: -
– removeObserver:forKeyPath:context:
Comparing Sets
-
– isEqualToOrderedSet: -
– intersectsOrderedSet: -
– intersectsSet: -
– isSubsetOfOrderedSet: -
– isSubsetOfSet:
Creating a Sorted Array
Describing a Set
Converting Other Collections
Class Methods
orderedSet
Creates and returns an empty ordered set
Return Value
A new empty ordered set.
Discussion
This method is declared primarily for the use of mutable subclasses of NSOrderedSet.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.horderedSetWithArray:
Creates and returns a set containing a uniqued collection of the objects contained in a given array.
Parameters
- array
An array containing the objects to add to the new ordered set. If the same object appears more than once in array, it is added only once to the returned set.
Return Value
A new ordered set containing a uniqued collection of the objects contained in array.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.horderedSetWithArray:range:copyItems:
Creates and returns a new ordered set for a specified range of objects in an array.
Parameters
- array
The array
- range
The range of the objects to add to the ordered set.
- flag
If
YESthe objects are copied to the ordered set; otherwiseNO.
Return Value
A new ordered set containing a uniqued collection of the objects contained in the specified range of the array.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.horderedSetWithObject:
Creates and returns a ordered set that contains a single given object.
Parameters
- object
The object to add to the new set.
Return Value
A new ordered set containing object.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.horderedSetWithObjects:
Creates and returns a ordered set containing the objects in a given argument list.
Parameters
- firstObj,
The first object to add to the new set.
- ...
A comma-separated list of objects, ending with
nil, to add to the new set.If the same object appears more than once in the list of objects, it is added only once to the returned set. The objects are added to the ordered set in the order that they are listed.
Return Value
A new ordered set containing the objects in the argument list.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.horderedSetWithObjects:count:
Creates and returns a set containing a specified number of objects from a given C array of objects.
Parameters
- objects
A C array of objects to add to the new ordered set.
If the same object appears more than once in objects, it is added only once to the returned ordered set. Each object receives a retain message as it is added to the set.
- cnt
The number of objects from objects to add to the new set.
Return Value
A new ordered set containing cnt objects from the list of objects specified by objects.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.horderedSetWithOrderedSet:
Creates and returns an ordered set containing the objects from another ordered set.
Parameters
- set
A set containing the objects to add to the new ordered set.
The objects are not copied, simply referenced.
Return Value
A new ordered set containing the objects from set.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.horderedSetWithOrderedSet:range:copyItems:
Creates and returns a new ordered set for a specified range of objects in an ordered set.
Parameters
- set
An ordered set.
- range
The range of objects in set to add to the ordered set.
- flag
If
YESthe objects are copied to the ordered set; otherwiseNO.
Return Value
A new ordered set containing a uniqued collection of the objects contained in the specified range of the the ordered set.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.horderedSetWithSet:
Creates and returns an ordered set with the contents of a set.
Parameters
- set
A set.
Return Value
A new ordered set containing a uniqued collection of the objects contained in the set.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.horderedSetWithSet:copyItems:
Creates and returns an ordered set with the contents of a set, optionally copying the items.
Parameters
- set
A set.
- flag
If
YESthe objects are copied to the ordered set; otherwiseNO.
Return Value
A new ordered set containing a uniqued collection of the objects contained in the specified range of the set.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hInstance Methods
addObserver:forKeyPath:options:context:
Raises an exception.
Parameters
- observer
The object to register for KVO notifications.
- keyPath
The key path, relative to the array, of the property to observe. This value must not be nil.
- options
A combination of
NSKeyValueObservingOptionsvalues that specifies what is included in observation notifications.- context
Arbitrary data that is passed to observer in
observeValueForKeyPath:ofObject:change:context:.
Discussion
NSOrderedSet objects are not observable, so this method raises an exception when invoked on an NSOrderedSet object. Instead of observing an ordered set, observe the to-many relationship for which the ordered set is the collection of related objects.
Availability
- Available in iOS 5.0 and later.
Declared In
NSKeyValueObserving.harray
Returns a representation of the ordered set as an array.
Return Value
An array containing the ordered set’s elements.
Discussion
This return a proxy object for the receiving ordered set, which acts like an immutable array.
While you cannot mutate the ordered set through this proxy, mutations to the original ordered set will be reflected in the proxy and it will appear to change spontaneously, since a copy of the ordered set is not being made.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hcontainsObject:
Returns a Boolean value that indicates whether a given object is present in the ordered set.
Parameters
- object
The object for which to test membership of the ordered set.
Return Value
YES if object is present in the set, otherwise NO.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hcount
Returns the number of members in the set.
Return Value
The number of members in the set.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hdescription
Returns a string that represents the contents of the ordered set, formatted as a property list.
Return Value
A string that represents the contents of the ordered set, formatted as a property list.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hdescriptionWithLocale:
Returns a string that represents the contents of the ordered set, formatted as a property list.
Parameters
- locale
An
NSLocaleobject or anNSDictionaryobject that specifies options used for formatting each of the ordered set’s elements (where recognized). Specifynilif you don’t want the elements formatted.
Return Value
A string that represents the contents of the ordered set, formatted as a property list.
Discussion
For a description of how locale is applied to each element in the receiving ordered set, see descriptionWithLocale:indent:.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hdescriptionWithLocale:indent:
Returns a string that represents the contents of the ordered set, formatted as a property list.
Parameters
- locale
An
NSLocaleobject or anNSDictionaryobject that specifies options used for formatting each of the array’s elements (where recognized). Specifynilif you don’t want the elements formatted.- level
Specifies a level of indentation, to make the output more readable: the indentation is (4 spaces) * level.
Return Value
A string that represents the contents of the ordered set, formatted as a property list.
Discussion
The returned NSString object contains the string representations of each of the ordered set’s elements, in order, from first to last. To obtain the string representation of a given element, descriptionWithLocale:indent: proceeds as follows:
If the element is an
NSStringobject, it is used as is.If the element responds to
descriptionWithLocale:indent:, that method is invoked to obtain the element’s string representation.If the element responds to
descriptionWithLocale:, that method is invoked to obtain the element’s string representation.If none of the above conditions is met, the element’s string representation is obtained by invoking its
descriptionmethod
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.henumerateObjectsAtIndexes:options:usingBlock:
Executes a given block using the objects in the ordered set at the specified indexes.
Parameters
- indexSet
The indexes of the objects over which to enumerate.
- opts
A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).
- block
The block to apply to elements in the ordered set.
The block takes three arguments:
- obj
The element in the ordered set.
- idx
The index of the element in the ordered set.
- stop
A reference to a Boolean value. The block can set the value to
YESto stop further processing of the array. The stop argument is an out-only argument. You should only ever set this Boolean toYESwithin the block.
Discussion
By default, the enumeration starts with the first object and continues serially through the ordered set to the last element specified by indexSet. You can specify NSEnumerationConcurrent and/or NSEnumerationReverse as enumeration options to modify this behavior.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.henumerateObjectsUsingBlock:
Executes a given block using each object in the ordered set.
Parameters
- block
The block to apply to elements in the ordered set.
The block takes three arguments:
- idx
The element in the set.
- idx
The index of the item in the set.
- stop
A reference to a Boolean value. The block can set the value to
YESto stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value toYESwithin the block.
The block returns a Boolean value that indicates whether obj passed the test.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.henumerateObjectsWithOptions:usingBlock:
Executes a given block using each object in the set, using the specified enumeration options.
Parameters
- opts
A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).
- block
The block to apply to elements in the ordered set.
The block takes three arguments:
- obj
The element in the set.
- idx
The index of the item in the set.
- stop
A reference to a Boolean value. The block can set the value to
YESto stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value toYESwithin the block.
The block returns a Boolean value that indicates whether obj passed the test.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hfirstObject
Returns the first object in the ordered set.
Return Value
The first object in the ordered set.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hgetObjects:range:
Copies the objects contained in the ordered set that fall within the specified range to objects.
Parameters
- objects
A C array of objects of size at least the length of the range specified by aRange.
- range
A range within the bounds of the array.
If the location plus the length of the range is greater than the count of the array, this method raises an
NSRangeException.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hindexesOfObjectsAtIndexes:options:passingTest:
Returns the index, from a given set of indexes, of the object in the ordered set that passes a test in a given block for a given set of enumeration options.
Parameters
- indexSet
The indexes of the objects over which to enumerate.
- opts
A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).
- predicate
The block to apply to elements in the ordered set.
The block takes three arguments:
- obj
The element in the ordered set.
- idx
The index of the element in the ordered set.
- stop
A reference to a Boolean value. The block can set the value to
YESto stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value toYESwithin the block.
The block returns a Boolean value that indicates whether obj passed the test.
Return Value
The index of the corresponding value in the ordered set that passes the test specified by predicate. If no objects in the ordered set pass the test, returns NSNotFound.
Discussion
By default, the enumeration starts with the first object and continues serially through the ordered set to the last object. You can specify NSEnumerationConcurrent and/or NSEnumerationReverse as enumeration options to modify this behavior.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hindexesOfObjectsPassingTest:
Returns the index of the object in the ordered set that passes a test in a given block.
Parameters
- predicate
The block to apply to elements in the ordered set.
The block takes three arguments:
- obj
The element in the ordered set.
- Term
The index of the element in the ordered set.
- stop
A reference to a Boolean value. The block can set the value to
YESto stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value toYESwithin the block.
Return Value
The index of the corresponding value in the ordered set that passes the test specified by predicate. If no objects in the ordered set pass the test, returns NSNotFound..
Discussion
If the block parameter is nil, this method raises an exception.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hindexesOfObjectsWithOptions:passingTest:
Returns the index of an object in the ordered set that passes a test in a given block for a given set of enumeration options.
Parameters
- opts
A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).
- predicate
The block to apply to elements in the ordered set.
The block takes three arguments:
- obj
The element in the ordered set.
- Term
The index of the element in the ordered set.
- stop
A reference to a Boolean value. The block can set the value to
YESto stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value toYESwithin the block.
Return Value
The index whose corresponding value in the ordered set passes the test specified by predicate and opts. If the opts bitmask specifies reverse order, then the last item that matches is returned. Otherwise, the index of the first matching object is returned. If no objects in the ordered set pass the test, returns NSNotFound.
Discussion
By default, the enumeration starts with the first object and continues serially through the ordered set to the last object. You can specify NSEnumerationConcurrent and/or NSEnumerationReverse as enumeration options to modify this behavior.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hindexOfObject:
Returns the index of the specified object.
Parameters
- object
The object.
Return Value
The index whose corresponding ordered set value is equal to object. If none of the objects in the ordered set is equal to object, returns NSNotFound.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hindexOfObject:inSortedRange:options:usingComparator:
Returns the index, within a specified range, of an object compared with elements in the ordered set using a given NSComparator block.
Parameters
- object
An object for which to search in the ordered set.
If this value is
nil, throws anNSInvalidArgumentException.- range
The range within the array to search for object.
If r exceeds the bounds of the ordered set (if the location plus length of the range is greater than the count of the ordered set), throws an
NSRangeException.- opts
Options for the search. For possible values, see
NSBinarySearchingOptions.- cmp
A comparator block used to compare the object obj with elements in the ordered set.
If this value is
NULL, throws anNSInvalidArgumentException.
Return Value
If the NSBinarySearchingInsertionIndex option is not specified:
If the object is found and neither
NSBinarySearchingFirstEqualnorNSBinarySearchingLastEqualis specified, returns the matching object's index.If the
NSBinarySearchingFirstEqualorNSBinarySearchingLastEqualoption is also specified, returns the index of equal objects.If the object is not found, returns
NSNotFound.
If the NSBinarySearchingInsertionIndex option is specified, returns the index at which you should insert obj in order to maintain a sorted array:
If the object is found and neither
NSBinarySearchingFirstEqualnorNSBinarySearchingLastEqualis specified, returns the matching object’s index.If the
NSBinarySearchingFirstEqualorNSBinarySearchingLastEqualoption is also specified, returns the index of the equal objects.If the object is not found, returns the index of the least greater object, or the index at the end of the array if the object is larger than all other elements.
Discussion
The elements in the ordered set must have already been sorted using the comparator cmp. If the ordered set is not sorted, the result is undefined.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hindexOfObjectAtIndexes:options:passingTest:
Returns the index, from a given set of indexes, of the object in the ordered set that passes a test in a given block for a given set of enumeration options.
Parameters
- indexSet
The indexes of the objects over which to enumerate.
- opts
A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).
- predicate
The block to apply to elements in the ordered set.
The block takes three arguments:
- obj
The element in the ordered set.
- idx
The index of the element in the ordered set.
- stop
A reference to a Boolean value. The block can set the value to
YESto stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value toYESwithin the block.
The block returns a Boolean value that indicates whether obj passed the test.
Return Value
The index of the corresponding value in the ordered set passes the test specified by predicate. If no objects in the ordered set pass the test, returns NSNotFound.
Discussion
By default, the enumeration starts with the first object and continues serially through the ordered set to the last element specified by indexSet. You can specify NSEnumerationConcurrent and/or NSEnumerationReverse as enumeration options to modify this behavior.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hindexOfObjectPassingTest:
Returns the index of the object in the ordered set that passes a test in a given block.
Parameters
- predicate
The block to apply to elements in the ordered set.
The block takes three arguments:
- obj
The element in the ordered set.
- Term
The index of the element in the ordered set.
- stop
A reference to a Boolean value. The block can set the value to
YESto stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value toYESwithin the block.
Return Value
The index of the corresponding value in the ordered set that passes the test specified by predicate. If no objects in the ordered set pass the test, returns NSNotFound.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hindexOfObjectWithOptions:passingTest:
Returns the index of an object in the ordered set that passes a test in a given block for a given set of enumeration options.
Parameters
- opts
A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).
- predicate
The block to apply to elements in the ordered set.
The block takes three arguments:
- obj
The element in the array.
- idx
The index of the element in the ordered set.
- stop
A reference to a Boolean value. The block can set the value to
YESto stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value toYESwithin the block.
The block returns a Boolean value that indicates whether obj passed the test.
Return Value
The index whose corresponding value in the ordered set passes the test specified by predicate and opts. If no objects in the ordered set pass the test, returns NSNotFound.
Discussion
By default, the enumeration starts with the first object and continues serially through the ordered set to the last object. You can specify NSEnumerationConcurrent and/or NSEnumerationReverse as enumeration options to modify this behavior.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hinitWithArray:
Initializes a newly allocated set with the objects that are contained in a given array.
Parameters
- array
An array of objects to add to the new set.
If the same object appears more than once in array, it is represented only once in the returned ordered set.
Return Value
An initialized ordered set with the contents of array. The returned ordered set might be different than the original receiver.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hinitWithArray:copyItems:
Initializes a newly allocated set with the objects that are contained in a given array, optionally copying the items.
Parameters
- array
An array of objects to add to the new set.
If the same object appears more than once in array, it is represented only once in the returned ordered set.
- flag
If
YESthe objects are copied to the ordered set; otherwiseNO.
Return Value
An initialized ordered set containing a uniqued collection of the objects contained in the array.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hinitWithArray:range:copyItems:
Initializes a newly allocated set with the objects that are contained in the specified range of an array, optionally copying the items.
Parameters
- array
An array of objects to add to the new set.
If the same object appears more than once in array, it is represented only once in the returned ordered set.
- range
The range of objects in array to add to the ordered set.
- flag
If
YESthe objects are copied to the ordered set; otherwiseNO.
Return Value
An initialized ordered set containing a uniqued collection of the objects contained in specified range of the the array.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hinitWithObject:
Initializes a new ordered set with the object.
Parameters
- object
The object to add to the new ordered set
Return Value
A new ordered set that contains a single member, object.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hinitWithObjects:
Initializes a newly allocated set with members taken from the specified list of objects.
Parameters
- firstObj,
The first object to add to the new set.
- ...
A comma-separated list of objects, ending with
nil, to add to the new ordered set.If the same object appears more than once in the list, it is represented only once in the returned ordered set.
Return Value
An initialized ordered set containing the objects specified in the parameter list. The returned set might be different than the original receiver.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hinitWithObjects:count:
Initializes a newly allocated set with a specified number of objects from a given C array of objects.
Parameters
- objects
A C array of objects to add to the new set.
If the same object appears more than once in objects, it is added only once to the returned ordered set.
- cnt
The number of objects from objects to add to the new ordered set.
Return Value
An initialized ordered set containing cnt objects from the list of objects specified by objects. The returned set might be different than the original receiver.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hinitWithOrderedSet:
Initializes a new ordered set with the contents of a set.
Parameters
- set
A set.
Return Value
An initialized ordered set containing references to the objects in the set.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hinitWithOrderedSet:copyItems:
Initializes a new ordered set with the contents of a set, optionally copying the items.
Parameters
- set
A set.
- flag
If
YESthe objects are copied to the ordered set; otherwiseNO.
Return Value
An initialized ordered set containing the objects in the set.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hinitWithOrderedSet:range:copyItems:
Initializes a new ordered set with the contents of an ordered set, optionally copying the items.
Parameters
- orderedSet
An ordered set.
- range
The range of objects in orderedSet to add to the ordered set.
- flag
If
YESthe objects are copied to the ordered set; otherwiseNO.
Return Value
An initialized ordered set containing the objects in the ordered set.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hinitWithSet:
Initializes a new ordered set with the contents of a set.
Parameters
- set
The set.
Return Value
An initialized ordered set containing the objects in the set.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hinitWithSet:copyItems:
Initializes a new ordered set with the contents of a set, optionally copying the objects in the set.
Parameters
- set
The set.
- flag
If
YESthe objects are copied to the ordered set; otherwiseNO.
Return Value
An initialized ordered set containing the objects in the set.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hintersectsOrderedSet:
Returns a Boolean value that indicates whether at least one object in the receiving ordered set is also present in another given ordered set.
Parameters
- other
The other ordered set.
Return Value
YES if at least one object in the receiving ordered set is also present in other, otherwise NO.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hintersectsSet:
Returns a Boolean value that indicates whether at least one object in the receiving ordered set is also present in another given set.
Parameters
- set
The set.
Return Value
YES if at least one object in the receiving ordered set is also present in other, otherwise NO.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hisEqualToOrderedSet:
Compares the receiving ordered set to another ordered set.
Parameters
- other
The ordered set with which to compare the receiving ordered set.
Return Value
YES if the contents of other are equal to the contents of the receiving ordered set, otherwise NO.
Discussion
Two ordered sets have equal contents if they each have the same number of members, if each member of one ordered set is present in the other, and the members are in the same order.
Availability
- Available in iOS 5.0 and later.
See Also
-
– intersectsSet: -
isEqual:(NSObject) -
– isSubsetOfOrderedSet:
Declared In
NSOrderedSet.hisSubsetOfOrderedSet:
Returns a Boolean value that indicates whether every object in the receiving ordered set is also present in another given ordered set.
Parameters
- other
The ordered set with which to compare the receiving ordered set.
Return Value
YES if every object in the receiving set is also present in other, otherwise NO.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hisSubsetOfSet:
Returns a Boolean value that indicates whether every object in the receiving ordered set is also present in another given set.
Parameters
- set
The set with which to compare the receiving ordered set.
Return Value
YES if every object in the receiving ordered set is also present in set, otherwise NO.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hlastObject
Returns the last object in the ordered set.
Return Value
The last object in the ordered set.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hobjectAtIndex:
Returns the object at the specified index of the set.
Parameters
- index
The object located at index.
Return Value
If index is beyond the end of the ordered set (that is, if index is greater than or equal to the value returned by count), an NSRangeException is raised.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hobjectAtIndexedSubscript:
Returns the object at the specified index of the set.
Parameters
- index
The object located at index.
Return Value
If index is beyond the end of the ordered set (that is, if index is greater than or equal to the value returned by count), an NSRangeException is raised.
Discussion
This method is the same as objectAtIndex:.
Availability
- Available in iOS 6.0 and later.
Declared In
NSOrderedSet.hobjectEnumerator
Returns an enumerator object that lets you access each object in the ordered set.
Return Value
An enumerator object that lets you access each object in the ordered set, in order, from the element at the lowest index upwards.
Special Considerations
When you use this method with mutable subclasses of NSOrderedSet, you must not modify the ordered set during enumeration.
It is more efficient to use the fast enumeration protocol (see NSFastEnumeration). Fast enumeration is available on OS X v10.5 and later and iOS 2.0 and later.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hobjectsAtIndexes:
Returns the objects in the ordered set at the specified indexes.
Parameters
- indexes
The indexes.
Return Value
The returned objects are in the ascending order of their indexes in indexes, so that object in returned ordered set with higher index in indexes will follow the object with smaller index in indexes.
Discussion
Raises an NSRangeException if any location in indexes exceeds the bounds of the array, of if indexes is nil.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hremoveObserver:forKeyPath:
Raises an exception.
Parameters
- observer
The object to remove as an observer.
- keyPath
A key-path, relative to the set, for which observer is registered to receive KVO change notifications. This value must not be nil.
Discussion
NSOrderedSet objects are not observable, so this method raises an exception when invoked on an NSOrderedSet object. Instead of observing an ordered set, observe the to-many relationship for which the ordered set is the collection of related objects.
Availability
- Available in iOS 5.0 and later.
Declared In
NSKeyValueObserving.hremoveObserver:forKeyPath:context:
Raises an exception.
Parameters
- observer
The object to remove as an observer.
- keyPath
A key-path, relative to the set, for which observer is registered to receive KVO change notifications. This value must not be nil.
- context
The context passed to the notifications.
Discussion
NSOrderedSet objects are not observable, so this method raises an exception when invoked on an NSOrderedSet object. Instead of observing an ordered set, observe the to-many relationship for which the ordered set is the collection of related objects.
Availability
- Available in iOS 5.0 and later.
Declared In
NSKeyValueObserving.hreversedOrderedSet
Returns an ordered set in the reverse order.
Return Value
Returns an ordered set in the reversed order of the receiver.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hreverseObjectEnumerator
Returns an enumerator object that lets you access each object in the ordered set.
Return Value
An enumerator object that lets you access each object in the ordered set, in order, from the element at the highest index downwards.
Special Considerations
When you use this method with mutable subclasses of NSOrderedSet, you must not modify the ordered set during enumeration.
It is more efficient to use the fast enumeration protocol (see NSFastEnumeration). Fast enumeration is available on OS X v10.5 and later and iOS 2.0 and later.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hset
Returns a representation of the set containing the contents of the ordered set.
Return Value
A set containing the ordered set’s elements.
Discussion
This return a proxy object for the receiving ordered set, which acts like an immutable set.
While you cannot mutate the ordered set through this proxy, mutations to the original ordered set will be reflected in the proxy and it will appear to change spontaneously, since a copy of the ordered set is not being made.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hsetValue:forKey:
Invokes setValue:forKey: on each of the receiver's members using the specified value and key
Parameters
- value
The object value.
- key
The key to store the value.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSKeyValueCoding.hsortedArrayUsingComparator:
Returns an array that lists the receiving ordered set’s elements in ascending order, as determined by the comparison method specified by a given NSComparator block
Parameters
- cmptr
A comparator block.
Return Value
An array that lists the receiving ordered set’s elements in ascending order, as determined by the comparison method specified cmptr.
Availability
- Available in iOS 5.0 and later.
Declared In
NSOrderedSet.hsortedArrayWithOptions:usingComparator:
Returns an array that lists the receiving ordered set’s elements in ascending order, as determined by the comparison method specified by a given NSComparator block.
Parameters
- opts
A bitmask that specifies the options for the sort (whether it should be performed concurrently and whether it should be performed stably).
- cmptr
A comparator block.
Return Value
An array that lists the receiving ordered set’s elements in ascending order, as determined by the comparison method specified cmptr.
Availability
- Available in iOS 5.0 and later.
See Also
Declared In
NSOrderedSet.hvalueForKey:
Returns an ordered set containing the results of invoking valueForKey: using key on each of the ordered set’s objects.
Parameters
- key
The key to retrieve.
Return Value
The ordered set of the values for the retrieved key. The returned ordered set might not have the same number of members as the receiver.
Discussion
The returned ordered set will not contain any elements corresponding to instances of valueForKey: returning nil, nor will it contain duplicates.
Availability
- Available in iOS 5.0 and later.
Declared In
NSKeyValueCoding.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-07-17)