Skip to content

Commit 2b18e0c

Browse files
committed
JAVA-4669: Fix CircularBuffer constructor
1 parent aefc96b commit 2b18e0c

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

data-structures/src/main/java/com/baeldung/circularbuffer/CircularBuffer.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ public class CircularBuffer<E> {
1010

1111
@SuppressWarnings("unchecked")
1212
public CircularBuffer(int capacity) {
13-
1413
this.capacity = (capacity < 1) ? DEFAULT_CAPACITY : capacity;
15-
this.data = (E[]) new Object[capacity];
16-
14+
this.data = (E[]) new Object[this.capacity];
1715
this.readSequence = 0;
1816
this.writeSequence = -1;
1917
}

0 commit comments

Comments
 (0)