Skip to content

Commit 2598cdb

Browse files
author
Alibaba
authoredMay 9, 2020
修改ArrayBlockingQueue的注释错误
int takeIndex;// 下一个被添加元素的索引 int count;// 队列中的元素个数
1 parent 46620c2 commit 2598cdb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎并发容器/大数据成神之路-Java高级特性增强(ArrayBlockingQueue).md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
### **Java高级特性增强-并发容器**
22
本部分网络上有大量的资源可以参考,在这里做了部分整理并做了大量勘误,感谢前辈的付出,每节文章末尾有引用列表~
3+
34
####**多线程**
5+
46
###**集合框架**
7+
58
###**NIO**
9+
610
###**Java并发容器**
711

812
### ArrayBlockingQueue介绍
@@ -125,11 +129,11 @@ public boolean offer(E e) {
125129
```
126130
说明:offer(E e)的作用是将e插入阻塞队列的尾部。如果队列已满,则返回false,表示插入失败;否则,插入元素,并返回true。(01) count表示”队列中的元素个数“。除此之外,队列中还有另外两个遍历takeIndex和putIndex。takeIndex表示下一个被取出元素的索引,putIndex表示下一个被添加元素的索引。它们的定义如下:
127131
```
128-
// 队列中的元素个数
132+
// 下一个被添加元素的索引
129133
int takeIndex;
130134
// 下一个被取出元素的索引
131135
int putIndex;
132-
// 下一个被添加元素的索引
136+
// 队列中的元素个数
133137
int count;
134138
```
135139
(02) insert()的源码如下:

0 commit comments

Comments
 (0)
Please sign in to comment.