Java 学习笔记(1)
来源:互联网 发布:手机淘宝的二手在哪里 编辑:程序博客网 时间:2024/05/17 05:11
HashMap
· It is a Map,which means it stores <Key, Value> pairs. Same key with different valueswill only be stored once in the map and only the last one put into map will bestored, i.e. when you put a value into the map, if the key already exists, thevalue will be replaced by the new one, which means you will lose the first value.
· It uses hashfunction. Objects for key must override the hashCode() method inherited fromclass object. HashMap re-hash the returned value of hashCode() to find thebucket. The reason of re-hashing is to avoid poor quality hash functions.
· When twodifferent keys have the same hash code, euqals() method comes to rescue.
· null key andnull value are allowed in HashMap.
· Note that theimplementation of HashMap is not synchronized.
ArrayList VS Vector
· Vector issynchronized while ArrayList is not.
· Vector is slow as it is thread safe. In comparisonArrayList is fast
· By default, a vector double the size of its array whenneeded, and ArrayList increases its array size by 50%
Thread Safety
The following description is from Wikipedia.
· Thread safety isa computer programming concept applicable in the context of multi-threadprograms
· A piece of codeis thread safe if it manipulatesshared data structures only in a manner that guarantees safe execution bymultiple threads at the same time.
0 0
- java学习笔记-1
- Java学习笔记1
- java学习笔记(1)
- java学习笔记1
- Java学习笔记1
- java学习笔记1
- java学习笔记(1)
- Java学习笔记1
- java学习笔记(1)
- JAVA学习笔记1
- java学习笔记1
- Java学习笔记(1)
- java学习笔记1
- JAVA学习笔记 1
- JAVA学习笔记(1)
- java学习笔记1
- java学习笔记 1
- java 学习笔记《1》
- Linux软件安装管理(二)-RPM命令管理
- Retrofit2 简明教程(一)
- NanoPi 2 GPIO的使用
- Qt 显示中文代码
- 单利
- Java 学习笔记(1)
- 【SSH系列】Hibernate映射 -- 继承映射
- 加密
- CToolBarCtrl,在工具栏中增加一个与按钮长度不一样宽的静态文本
- 使用zkweb维护zookeeper数据
- [DIV/CSS] Vue.js 开发实践:实现精巧的无限加载与分页功能
- 各种数据库连接串的配置收集
- xUtils API 文档
- 拦截器和过滤器的区别