- 博客(4)
- 收藏
- 关注
原创 为什么HashMap、HashSet是线程不安全的(JDK 1.8)
1. HashMap<K, V>以put()方法为例,结合JDK源码分析/** * Constructs an empty <tt>HashMap</tt> with the default initial capacity * (16) and the default load factor (0.75). */public HashMap() {...
2020-04-13 14:39:41
1028
原创 Fail-fast & Fail-safe
Fail-fast单线程操作iterator时(以ArrayList为例)List<Integer> integers = new ArrayList<>();integers.add(1);integers.add(2);integers.add(3);/** fail-fast in Iterator* Throw ConcurrentModificat...
2019-12-10 11:45:50
175
原创 String vs StringBuffer vs StringBuilder
可变性String 对象不可变。当给 String 引用赋予变化时,会创建新的 String 对象,原字符串对象失去引用。String 类中使用 final 关键字修饰字符数组来保存字符串,private final char value[]StringBuffer & StringBuilder 对象可变。它们均继承自 AbstractStringBuilder 类,在 Abst...
2019-11-30 17:21:42
231
转载 Rust - Getting Started
Rust - Getting StartedInstalling Rust on MacOsProject and Package ManageHello RustA simple application with dependencyInstalling Rust on MacOsRustup: the Rust installer and version management tool....
2019-11-17 17:01:41
309
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人