Last active
March 2, 2018 04:55
-
-
Save hikarin522/cc0090384303ef9f514a72820ee73040 to your computer and use it in GitHub Desktop.
Swift: [Equatable]?の比較 ref: https://qiita.com/hikarin522/items/1fed2d7ab727cd470d0a
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
func ==<Element: Equatable>(lhs: [Element]?, rhs: [Element]?) -> Bool { | |
return lhs.map { l in rhs.map { l == $0 } ?? false } | |
?? rhs.map { r in lhs.map { $0 == r } ?? false } | |
?? true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment