티스토리 뷰

728x90
fun <K, V> mutableMapWithCapacity(capacity: Int): MutableMap<K, V> =
    LinkedHashMap(capacity)

fun <T> mutableListWithCapacity(capacity: Int): MutableList<T> =
    ArrayList(capacity)

https://stackoverflow.com/questions/61698098/kotlin-mutablelist-initial-capacity

 

Kotlin MutableList initial capacity

I'm creating a list of values, in a context where it so happens that, though the values are being added one at a time, the eventual number is known in advance. This is in a function that will be ca...

stackoverflow.com

 

728x90

'공부' 카테고리의 다른 글

[python] list deep copy  (0) 2023.04.28
[python] // (몫) 연산자  (0) 2023.04.28
[Airflow] How to skip task in Airflow operator?  (0) 2023.04.26
[spark] dynamodb  (0) 2023.04.24
[python] pip3 install github  (0) 2023.04.24
댓글