This should probably be (0 until maxBucket + 1).map(_ => Counter(threadSafe)).toIndexedSeq or .toArray I think

new Array(int) is just a hint for the initial underlying size, I don't think it can work with a map.