JAVA-4669: Fix CircularBuffer constructor

This commit is contained in:
Krzysztof Woyke 2021-03-11 20:12:28 +01:00
parent c9bc95a5e2
commit 0545265255
1 changed files with 1 additions and 3 deletions

View File

@ -10,10 +10,8 @@ public class CircularBuffer<E> {
@SuppressWarnings("unchecked")
public CircularBuffer(int capacity) {
this.capacity = (capacity < 1) ? DEFAULT_CAPACITY : capacity;
this.data = (E[]) new Object[capacity];
this.data = (E[]) new Object[this.capacity];
this.readSequence = 0;
this.writeSequence = -1;
}