this.capacity = capacity; this.buffer = new Array(capacity); for (var i = 0; i < this.buffer.length; i++) { this.buffer[i] = new LinkedList(); }
this.buffer = Array.from({length : capacity} , _ => new LinkedList());
this.buffer = Array(capacity).fill(new LinkedList());
this.buffer = Array.from(Array(capacity), () => new LinkedList());
this.buffer = [...Array(capacity)].map(() => new LinkedList);