# NSOrderedSet documentation

greg.casamento@gmail.com
Generated at 2025-12-02 21:52:00 +0000
2019 Free Software Foundation, Inc.
Software documentation for the NSMutableOrderedSet class
Foundation/NSOrderedSet.h
This class provides a mutable ordered set.
orderedSetWithCapacity:
capacity
Returns an ordered set with capacity.
addObject:
anObject
Adds an object to the receiver.
addObjects:
objects
count:
count
Adds items in the C array whose length is indicated by count to the receiver.
addObjectsFromArray:
otherArray
Adds objects from otherArray to the receiver.
exchangeObjectAtIndex:
index
withObjectAtIndex:
otherIndex
Exchange object at index with object at otherIndex.
filterUsingPredicate:
predicate
Filter objects using predicate.
init
Initializes an empty ordered set.
initWithCapacity:
capacity
Initializes an ordered set with capacity.
initWithCoder:
coder
Implementation of NSCopying protocol.
insertObject:
object
atIndex:
index
Inserts object into the receiver at index.
insertObjects:
array
atIndexes:
indexes
Inserts objects at indexes from array. The number of elements in indexes must be the same as the number of elements in array.
intersectOrderedSet:
aSet
This method leaves only objects that interesect with ordered set aSet in the receiver.
intersectSet:
aSet
This method leaves only objects that intersect with set aSet in the receiver.
minusOrderedSet:
aSet
Receiver contains itself minus those elements in ordered set aSet.
minusSet:
aSet
Receiver contains itself minus those elements in aSet.
moveObjectsAtIndexes:
indexes
toIndex:
index
Move objects at indexes to index .
removeAllObjects
Remove all objects from the set.
removeObject:
object
Remove object from receiver.
removeObjectAtIndex:
index
Remove object at index.
removeObjectsAtIndexes:
indexes
Remove objects at indexes.
removeObjectsInArray:
otherArray
Remove objects matching items in otherArray.
removeObjectsInRange:
range
Remove objects at indexes matching range.
replaceObjectAtIndex:
index
withObject:
object
Replace the object at index with object.
replaceObjectsAtIndexes:
indexes
withObjects:
objects
Replace objects at indexes with objects. The number of objects must correspond to the number of indexes.
replaceObjectsInRange:
range
withObjects:
objects
count:
count
Replace objects in the given range with items from the C array objects.
setObject:
object
atIndex:
index
Set object at index.
setObject:
object
atIndexedSubscript:
index
Sets the object at index/
sortRange:
range
options:
options
usingComparator:
comparator
Sort the given range using options and comparator.
sortUsingComparator:
comparator
Sort using comparator
sortUsingDescriptors:
descriptors
Sort using descriptors.
sortWithOptions:
options
usingComparator:
comparator
Sort with options and comparator .
unionOrderedSet:
aSet
Receiver contains the union of itself and ordered set aSet.
unionSet:
aSet
Receiver contains the union of itself and aSet.
Software documentation for the NSOrderedSet class
Foundation/NSOrderedSet.h
NSCoding
NSCopying
NSMutableCopying
NSFastEnumeration
This class provides an ordered set, a set where the order of the elements matters and is preserved. Once created the set cannot be modified. NSMutableOrderedSet can be modified.
orderedSet
Create and return an empty ordered set.
orderedSetWithArray:
objects
Create and return an empty ordered set with the provided NSArray instance.
orderedSetWithArray:
objects
range:
range
copyItems:
flag
Create and return an empty ordered set with the provided NSArray instance. Use the range to determine which elements to use. If flag is `YES` copy the elements.
orderedSetWithObject:
anObject
Create and return an ordered set with anObject as the sole member.
orderedSetWithObjects:
firstObject
Create and return an ordered set with list of arguments starting with firstObject and terminated with `nil`.
orderedSetWithObjects:
objects
count:
count
Create and return an ordered set using the C array of objects with count.
orderedSetWithOrderedSet:
aSet
Create and return an ordered set with the provided ordered set aSet.
orderedSetWithSet:
aSet
Create and return an ordered set with set aSet.
orderedSetWithSet:
aSet
copyItems:
flag
Create and return an ordered set with the elements in aSet. If flag is `YES`, copy the elements.
array
Returns an NSArray instance with the objects contained in the receiver.
containsObject:
anObject
Returns `YES` if the receiver contains anObject.
count
Return the number of elements in the receiver.
description
Description of this NSOrderedSet.
descriptionWithLocale:
locale
Localized description of this NSOrderedSet.
descriptionWithLocale:
locale
indent:
flag
Localized description, indented if flag is `YES`.
enumerateObjectsAtIndexes:
indexSet
options:
opts
usingBlock:
aBlock
Enumerate over the objects whose indexes are contained in indexSet, with the opts provided using aBlock.
enumerateObjectsUsingBlock:
aBlock
Enumerate over all objects in the receiver using aBlock.
enumerateObjectsWithOptions:
opts
usingBlock:
aBlock
Enumerate over all objects in the receiver with aBlock utilizing the options specified by opts.
filteredOrderedSetUsingPredicate:
predicate
Returns an NSOrderedSet instance containing elements filtered using predicate.
firstObject
First object in the receiver.
getObjects:
aBuffer
range:
aRange
Returns a C array of objects in aBuffer at indexes specified by aRange.
indexOfObject:
anObject
Returns the index of anObject in the receiver.
indexOfObject:
key
inSortedRange:
range
options:
options
usingComparator:
comparator
Returns the index of object key, contained within range, using options, and the provided comparator.
indexOfObjectAtIndexes:
indexSet
options:
opts
passingTest:
predicate
Returns the index of objects at indexSet that pass the test in predicate with enumeration options opts.
indexOfObjectPassingTest:
predicate
Returns the index of the first object passing test predicate.
indexOfObjectWithOptions:
opts
passingTest:
predicate
Returns the index of the first object passing test predicate using enumeration options opts.
indexesOfObjectsAtIndexes:
indexSet
options:
opts
passingTest:
predicate
Returns an NSIndexSet containing indexes of object at indexes in indexSet matching predicate with enumeration options opts.
indexesOfObjectsPassingTest:
predicate
Returns an NSIndexSet containing indexes that match predicate.
indexesOfObjectsWithOptions:
opts
passingTest:
predicate
Returns an NSIndexSet containing indexes that match predicate using opts.
init
Initialize an empty ordered set.
initWithArray:
array
Initialize and return an empty ordered set with the provided NSArray instance.
initWithArray:
array
copyItems:
flag
Initialize and return an empty ordered set with the provided NSArray instance. If flag is `YES` copy the elements.
initWithArray:
array
range:
range
copyItems:
flag
Initialize and return an empty ordered set with the provided NSArray instance. Use the range to determine which elements to use. If flag is `YES` copy the elements.
initWithObject:
object
Initialize and return an ordered set with anObject as the sole member.
initWithObjects:
firstObject
Initialize and return an ordered set with list of arguments starting with firstObject and terminated with `nil`.
initWithObjects:
objects
count:
count
Initialize to contain (unique elements of) objects.
Calls -init (which does nothing but maintain MacOS-X compatibility), and needs to be re-implemented in subclasses in order to have all other initialisers work.
initWithOrderedSet:
aSet
Initialize and return an ordered set using the C array of objects with count.
initWithOrderedSet:
aSet
copyItems:
flag
Initialize and return an ordered set with the elements in aSet. If flag is `YES`, copy the elements.
initWithOrderedSet:
aSet
range:
range
copyItems:
flag
Initialize and return an empty ordered set with the provided NSArray instance. Use the range to determine which elements to use. If flag is `YES` copy the elements.
initWithSet:
aSet
Initialize and return an ordered set with set aSet.
initWithSet:
aSet
copyItems:
flag
Initialize and return an ordered set with set aSet. If flag is `YES`, then copy the elements.
intersectsOrderedSet:
aSet
Returns `YES` if the receiver intersects with ordered set aSet.
intersectsSet:
aSet
Returns `YES` if the receiver intersects with set aSet.
isEqualToOrderedSet:
aSet
Returns `YES` if the receiver is equal to aSet.
isSubsetOfOrderedSet:
aSet
Returns `YES` if the receiver is a subset of ordered set aSet.
isSubsetOfSet:
aSet
Returns `YES` if the receiver is a subset of set aSet.
lastObject
Last object in the receiver.
objectAtIndex:
index
Returns the object at index in the receiver.
objectAtIndexedSubscript:
index
Returns the object at index in the receiver.
objectEnumerator
Returns an NSEnumerator to iterate over each object in the receiver.
objectsAtIndexes:
indexes
Returns objects at the indexes specified in the receiver.
reverseObjectEnumerator
Returns an NSEnumerator to iterate over each object in the receiver in reverse order.
reversedOrderedSet
Returns an NSOrderedSet that contains the same objects as the receiver, but in reverse order.
set
Returns an NSSet instance with the objects contained in the receiver.
setValue:
value
forKey:
key
Set value for key.
sortedArrayUsingComparator:
comparator
Returns an NSArray instance containing the elements from the receiver sorted using comparator.
sortedArrayUsingDescriptors:
sortDescriptors
Returns an NSArray instance containing the elements from the receiver sorted using sortDescriptors.
sortedArrayWithOptions:
options
usingComparator:
comparator
Returns an NSArray instance containing the elements from the receiver using options, sorted using comparator.
valueForKey:
key
Returns the value for a given key.