---
title: "differenceFromArray:withOptions:usingEquivalenceTest:"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsarray/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.

## Declaration

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

## Discussion

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 when providing a block for the equivalence test. The changes returned in the difference object don’t include valid values for associatedIndex.

## See Also

### Comparing with Another Array

- [differenceFromArray:](foundation/nsarray/differencefromarray:.md)
- [differenceFromArray:withOptions:](foundation/nsarray/differencefromarray:withoptions:.md)
- [NSOrderedCollectionDifference](foundation/nsorderedcollectiondifference.md)
- [NSOrderedCollectionDifferenceCalculationOptions](foundation/nsorderedcollectiondifferencecalculationoptions.md)
