'Initialise ArrayList<ArrayList<Int>> with a size in kotlin

I am trying to initialise a list with a size in the constructor. But the size of my list is 0.

val seqList = ArrayList<ArrayList<Int>>(N) // This has the Problem
val queries = ArrayList<Query>(Q) // This works like a charm

I have both N and Q set as non zero inputs from the user lets say N = 100 and Q = 100

While debugging my code I found out that, queries.size() = 100 but seqList.size() = 0

Is my assumption incorrect, that seqList should also have been initialized with N ArrayList<Int> objects.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source