Contents

NSOrderedCollectionDifference

An object representing the difference between two ordered collections.

Declaration

class NSOrderedCollectionDifference

Overview

Use differenceFromArray: or one of its variations to get an instance of NSOrderedCollectionDifference, which represents the difference between two ordered collections.

For example, the following sample compares two arrays of strings to create a difference that represents the changes:

NSArray *original = @[@"Red", @"Green", @"Blue"];
NSArray *modified = @[@"Red", @"Blue", @"Green"];

NSOrderedCollectionDifference *diff = [original differenceFromArray:modified];

// diff.hasChanges == TRUE
// diff.insertions.count == 1
// diff.removals.count == 1

Topics

Accessing Changes

Inverting a Difference Object

Creating a Collection Difference Object

Updating Changes from a Difference Object

Initializers

See Also

Comparing with Another Array