Created
November 6, 2019 17:42
-
-
Save Briahas/498e630c11b099364d769222f33e9aae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Array where Element: Hashable { | |
func difference(from other: [Element]) -> [Element] { | |
let thisSet = Set(self) | |
let otherSet = Set(other) | |
return Array(thisSet.symmetricDifference(otherSet)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment