不可改变性imutable
不可改变性是指一些对象在被创建之后不会因为某些方式改变,特别是针对任何可以改变哈希对象的哈希值的方式。
两者相联系是因为哈希键值一定是不可改变的,所以它们对应的哈希键值也不改变。
如果允许它们改变,那么它们在数据结构如哈希表中的存储位置也会改变,因此会与哈希的概念违背,效率会大打折扣。
Hashing is the process of converting some large amount of data into a much smaller amount (typically a single integer) in a repeatable way so that it can be looked up in a table in constant-time (O(1)), which is important for high-performance algorithms and data structures.
Immutability is the idea that an object will not change in some important way after it has been created, especially in any way that might change the hash value of that object.
The two ideas are related because objects which are used as hash keys must typically be immutable so their hash value doesn't change. If it was allowed to change then the location of that object in a data structure such as a hashtable would change and then the whole purpose of hashing for efficiency is defeated.
To really grasp the idea you should try to implement your own hashtable in a language like C/C++, or read the Java implementation of the HashMap class.
不可改变性imutable的更多相关文章
- 关于新书《修炼之道:.NET开发要点精讲》的各种说明
索引 新书介绍 新书封面 新书目录 试读章节 原稿试读 网购地址 规格参数 反馈方式 一些感谢 附加说明 1.新书介绍 从2013年年底到2014年9月,历时将近10个月,这本书终于看到了“出版发行” ...
- List 源码分析笔记
List Class Diagram: 笔记一: 1.Iterable 接口只定义一个iterator()方法. Iterator 接口有hasNext, next, remove方法. ListIt ...
- 面试题整理:C#(一)
该系列持续更新,从网上以及身边收集的问题 1.可访问性级别有哪几种 public 访问不受限制.protected 访问仅限于包含类或从包含类派生的类型.internal 访问仅限于当前程序集.pro ...
- String与StringBuilder之间区别(转)
当我们在初学使用C#时,常常会不知道该用StringBuilder合适还是用String高效,下面是我在学习当中对StringBuilder和String的区别总结,分享给大家. String类有不可 ...
- 面向服务体系架构(SOA)和数据仓库(DW)的思考基于 IBM 产品体系搭建基于 SOA 和 DW 的企业基础架构平台
面向服务体系架构(SOA)和数据仓库(DW)的思考 基于 IBM 产品体系搭建基于 SOA 和 DW 的企业基础架构平台 当前业界对面向服务体系架构(SOA)和数据仓库(Data Warehouse, ...
- Python入门笔记(5):对象
一.学习目录 1.pyhton对象 2.python类型 3.类型操作符与内建函数 4.类型工厂函数 5.不支持类型 二.思考 1.Python解释执行原理? 2.Python对象机制? 3.Pyth ...
- ISO9126软件质量模型
ISO9126软件质量模型,是评价软件质量的国际标准.6个特性27个子特性组成. ISO/IEC9126软件质量模型是一种评价软件质量的通用模型,包括3个层次: 1.质量特性 2.质量子特性 3.度量 ...
- [Effective Java]第六章 枚举和注解
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- JAVA 中关于String的特性
一.初始化String的两种方式 String str1 = "hello"; String str2 = new String("hello"); 第一种方式 ...
随机推荐
- 自写Jquery插件 Tab
原创文章,转载请注明出处,谢谢!https://www.cnblogs.com/GaoAnLee/p/9067017.html 每每看到别人写的Jquery插件,自己也试着学习尝试,终有结果,废话不多 ...
- Spring框架之使用JdbcTemplate开发Dao层程序
简介: JdbcTemplate开发dao层程序 由Spring框架给我们提供,Spring提供的很多操作数据源(关系型数据库,二维表格模型,有明确的行和列(mysql/orcal等) 非关系 ...
- asyncio 学习
来自:https://www.syncd.cn/article/asyncio_article_02 一.asyncio之—-入门初探 通过上一篇关于asyncio的整体介绍,看过之后基本对async ...
- P4172 [WC2006]水管局长(LCT)
P4172 [WC2006]水管局长 LCT维护最小生成树,边权化点权.类似 P2387 [NOI2014]魔法森林(LCT) 离线存储询问,倒序处理,删边改加边. #include<iostr ...
- python简说(十六)第三方模块安装
安装第三模块 1.pip install xxx pip问题 1.提示没有pip命令的, 把python的安装目录. 安装目录下面的scripts目录加入到环境变量里面 2.Unknown or un ...
- Nikto
https://cirt.net/nikto2 Fire Up Kali & Open Nikto Let's fire up Kali and get started with nikto. ...
- ODAC(V9.5.15) 学习笔记(四)TMemDataSet (1)
所有的数据集类组件都是从TMemDataSet继承下来的,该组件实现了内存中对数据的管理,其主要的属性.方法和事件如下. 1.数据更新 名称 类型 说明 CachedUpdates Boolean 数 ...
- C#开发者工具网
使用key值[123456]对[50cms]进行对称加密-在线DES对称加密/解密- 开发者工具网 http://tool.sufeinet.com/Encrypt/DesEncrypt.aspx? ...
- 如何开启Intel HAXM功能
1. 启用BIOS中的Intel(R) Virtualization Technology选项 2.设置成功后,在控制台中输入sc query intelhaxm.出现下图即为成功 3. 启动andr ...
- hihoCoder week20 线段树的区间修改
区间修改 区间查询 最后一场比赛前的无可救药的热身 #include <bits/stdc++.h> using namespace std; #define mid ((l+r)/2) ...