Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I try to do this with (same as java)

val disabledNos = intArrayOf(1, 2, 3, 4)
var integers = Arrays.asList(disabledNos)

but this doesn't give me a list. Any ideas?

question from:https://stackoverflow.com/questions/46662513/convert-array-to-list-in-kotlin

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
157 views
Welcome To Ask or Share your Answers For Others

1 Answer

Kotlin support in the standard library this conversion.

You can use directly

disableNos.toList()

or if you want to make it mutable:

disableNos.toMutableList()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...