提交 ad6604f2 编写于 作者: S shuang.kou

AbstractStringBuilder类中不是使用char[]数组保存字符串, 而是byte[]

上级 8a54fdaa
Github用户如果访问速度缓慢的话,可以转移到[码云](https://gitee.com/SnailClimb/JavaGuide )查看。
Github用户如果访问速度缓慢的话,可以转移到[码云](https://gitee.com/SnailClimb/JavaGuide )查看,或者[在线阅读](https://snailclimb.gitee.io/javaguide )
[阿里云高性能服务器,1核1g最低89,不限性能。](https://www.aliyun.com/minisite/goods?userCode=hf47liqn)
......@@ -30,8 +30,6 @@ Github用户如果访问速度缓慢的话,可以转移到[码云](https://git
</a >
</p>
推荐使用 https://snailclimb.gitee.io/javaguide 在线阅读,在线阅读内容本仓库同步一致。这种方式阅读的优势在于:阅读体验会更好。
## 目录
- [Java](#java)
......
......@@ -32,6 +32,12 @@
**同步与异步**
关于同步和异步的概念解读困扰着很多程序员,大部分的解读都会带有自己的一点偏见。参考了 [Stackoverflow](https://stackoverflow.com/questions/748175/asynchronous-vs-synchronous-execution-what-does-it-really-mean)相关问题后对原有答案进行了进一步完善:
> When you execute something synchronously, you wait for it to finish before moving on to another task. When you execute something asynchronously, you can move on to another task before it finishes.
>
> 当你同步执行某项任务时,你需要等待其完成才能继续执行其他任务。当你异步执行某些操作时,你可以在完成另一个任务之前继续进行。
- **同步:** 同步就是发起一个调用后,被调用者未处理完请求之前,调用不返回。
- **异步:** 异步就是发起一个调用后,立刻得到被调用者的回应表示已接收到请求,但是被调用者并没有返回结果,此时我们可以处理其他的请求,被调用者通常依靠事件,回调等机制来通知调用者其返回结果。
......
......@@ -207,14 +207,20 @@ Constructor 不能被 override(重写),但是可以 overload(重载),所
StringBuilder 与 StringBuffer 的构造方法都是调用父类构造方法也就是 AbstractStringBuilder 实现的,大家可以自行查阅源码。
AbstractStringBuilder.java
`AbstractStringBuilder.java`
```java
abstract class AbstractStringBuilder implements Appendable, CharSequence {
/**
* The value is used for character storage.
*/
char[] value;
/**
* The count is the number of characters used.
*/
int count;
AbstractStringBuilder() {
}
AbstractStringBuilder(int capacity) {
value = new char[capacity];
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册