Skip to content

Instantly share code, notes, and snippets.

@popochess
Last active September 5, 2018 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save popochess/4021188dbbee4d0846fe1c8ee5ee8918 to your computer and use it in GitHub Desktop.
Save popochess/4021188dbbee4d0846fe1c8ee5ee8918 to your computer and use it in GitHub Desktop.
之前一直搞不懂 Hashable 跟 Equatable ,剛剛終於懂了
因為 Hashable inherit Equatable,所以 Hashable 除了可以比較 == object 外, 還可以做 great than 跟 less than , hash有 not duplicate的特性,所以也可以做用 duplicate,這樣的用意就可以延伸到做 sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment