<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSArray/differenceFromArray:withOptions:usingEquivalenceTest:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSArray(im)differenceFromArray:withOptions:usingEquivalenceTest:"
  },
  "title" : "differenceFromArray:withOptions:usingEquivalenceTest:"
}
-->

# differenceFromArray:withOptions:usingEquivalenceTest:

Compares two arrays, using the provided block and with options, to create a difference object that represents the changes between them.

```
- (NSOrderedCollectionDifference<id> *) differenceFromArray:(NSArray<id> *) other withOptions:(NSOrderedCollectionDifferenceCalculationOptions) options usingEquivalenceTest:(BOOL (^)(ObjectType obj1, ObjectType obj2)) block;
```

## Discussion

The options allow you to choose to omit insertion or removal references to the change objects within the difference object’s changes. Don’t use the option [`inferMoves`](/documentation/Foundation/NSOrderedCollectionDifferenceCalculationOptions/inferMoves) when providing a block for the equivalence test. The changes returned in the difference object don’t include valid values for [`associatedIndex`](/documentation/Foundation/NSOrderedCollectionChange/associatedIndex).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)