美文网首页
Ruby: Hash Code

Ruby: Hash Code

作者: bookinstock_ | 来源:发表于2017-04-27 21:23 被阅读27次

intro

  • hash code is not Hash key-value data structure.
  • hash code is usually a short identifier of an object.
  • the short identifier is usually a numeric value, so it is faster.
  • eql?() method compare with two objects' hash codes.
  • hash() method return the object's hash code.
  • better overwrite ==, hash, and eql? methods.
  • Array#uniq, Hash#lookups compare with hash code.

相关文章

网友评论

      本文标题:Ruby: Hash Code

      本文链接:https://www.haomeiwen.com/subject/prbnzttx.html