📜  快速查找两个数组之间的差异 - Swift 代码示例

📅  最后修改于: 2022-03-11 15:00:58.060000             🧑  作者: Mango

代码示例1
extension Array where Element: Hashable {
    func difference(from other: [Element]) -> [Element] {
        let thisSet = Set(self)
        let otherSet = Set(other)
        return Array(thisSet.symmetricDifference(otherSet))
    }
}