<!--
{
  "documentType" : "article",
  "framework" : "AppStoreConnectAPI",
  "identifier" : "/documentation/AppStoreConnectAPI/converting-arrays-to-sets",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Converting arrays to sets"
}
-->

# Converting arrays to sets

Return the content of a list, with duplicates removed and sorted, so that you can compare it to another set.

## Discussion

Use the `asSet()` function in the expression of a matchmaking rule to convert arrays to sets. For example, `asSet([ `4`, `3`, `2`, `1`, `4`, `1` ])` returns `[ `1`, `2`, `3`, `4` ]` with the duplicates removed and ordered incrementally, and `asSet([ ‘d’, ‘c’, ‘b’, ‘a’, ‘d’, ‘a’ ])` returns `[ ‘a’, ‘b’, ‘c’, ‘d’ ]` ordered alphabetically.

### Declaration

```other
array[Any] asSet(array[Any] list)
```

### Parameters

-`list`: An array to convert to a set.

### Return value

A set that contains the contents of `list` with the duplicates removed and sorted in an order that’s natural to the contents.

---

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)