Contents

NSOrderedSet

A static, ordered collection of unique objects.

Declaration

class NSOrderedSet

Overview

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.

Topics

Creating an Ordered Set

Initializing an Ordered Set

Counting Entries

Accessing Set Members

Key-Value Coding Support

Key-Value Observing Support

Comparing Sets

Creating a Sorted Array

Filtering Ordered Sets

Describing a Set

Converting Other Collections

Comparing with Another Set

Initializers

Default Implementations

See Also

Specialized Sets