博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hashCode()
阅读量:4684 次
发布时间:2019-06-09

本文共 2017 字,大约阅读时间需要 6 分钟。

  /**     * Returns a hash code value for the object. This method is     * supported for the benefit of hash tables such as those provided by     * {
@link java.util.HashMap}. *

* The general contract of {

@code hashCode} is: *

    *
  • Whenever it is invoked on the same object more than once during * an execution of a Java application, the {
    @code hashCode} method * must consistently return the same integer, provided no information * used in {
    @code equals} comparisons on the object is modified. * This integer need not remain consistent from one execution of an * application to another execution of the same application. *
  • If two objects are equal according to the {
    @code equals(Object)} * method, then calling the {
    @code hashCode} method on each of * the two objects must produce the same integer result. *
  • It is not required that if two objects are unequal * according to the {
    @link java.lang.Object#equals(java.lang.Object)} * method, then calling the {
    @code hashCode} method on each of the * two objects must produce distinct integer results. However, the * programmer should be aware that producing distinct integer results * for unequal objects may improve the performance of hash tables. *
*

* As much as is reasonably practical, the hashCode method defined by * class {

@code Object} does return distinct integers for distinct * objects. (This is typically implemented by converting the internal * address of the object into an integer, but this implementation * technique is not required by the * JavaTM programming language.) * * @return a hash code value for this object. * @see java.lang.Object#equals(java.lang.Object) * @see java.lang.System#identityHashCode */ public native int hashCode();

 

转载于:https://www.cnblogs.com/zno2/p/4699935.html

你可能感兴趣的文章
POJ 2378 Tree Cutting(树形DP,水)
查看>>
第二冲刺阶段个人博客5
查看>>
UVA 116 Unidirectional TSP (白书dp)
查看>>
第三方测速工具
查看>>
MySQL 网络访问连接
查看>>
在aws ec2上使用root用户登录
查看>>
数据访问 投票习题
查看>>
CIO知识储备
查看>>
cnblog!i'm coming!
查看>>
使用点符号代替溢出的文本
查看>>
Axios 中文说明
查看>>
fatal: remote origin already exists.
查看>>
gridview 自定义value值
查看>>
svn 的一些资料
查看>>
Json第三方类库Json.Net,声称超过其他Json序列化机制
查看>>
windows下xgboost安装到python
查看>>
[C#源码]VS各版本转换器(支持VS2012,VS2013)
查看>>
[POJ3281] Dining
查看>>
Ubuntu 14.04 SSH + 远程登录xrdp
查看>>
利用MacBook Air入侵无线网络
查看>>