y
01/12/2023, 5:55 AMInt
(such as List
), is Int.MAX_VALUE
the maximum number of elements they can store?ephemient
01/12/2023, 7:08 AMList
implementation could contain more than Int.MAX_VALUE
elements (the ones beyond that won't be indexable, but they might exist). however, the typical ones are backed by arrays, and while neither Kotlin nor the JVM document what the maximum array size is, most code assumes it's somewhere near Int.MAX_VALUE
(e.g. https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/jdk/internal/util/ArraysSupport.java#L589)y
01/12/2023, 7:09 AM