Skip to content

Commit

Permalink
small modify
Browse files Browse the repository at this point in the history
  • Loading branch information
tywo45 committed Sep 28, 2019
1 parent 84b1544 commit 7a572d3
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public boolean add(T t) {
}
log.info("队列已满,不过等到了空位置");
}
array[tailIndex] = t;
if (++tailIndex == capacity) {
array[tailIndex++] = t;
if (tailIndex == capacity) {
tailIndex = 0;
}
size++;
Expand All @@ -91,8 +91,8 @@ public T poll() {
return null;
}
T t = array[headIndex];
array[headIndex] = null;
if (++headIndex == capacity) {
array[headIndex++] = null;
if (headIndex == capacity) {
headIndex = 0;
}
size--;
Expand Down

0 comments on commit 7a572d3

Please sign in to comment.