Hey I was wondering how I could add two lists toge...
# getting-started
t
Hey I was wondering how I could add two lists together like this
Copy code
val list1 = listOf("hello", "world")
val list2 = listOf(*list1, "test")
I mainly just need to spread list1 into list2 so the type is List<String> on list2
e
Copy code
listOf(*list1.toTypedArray(), "test")
but don't do that, because
Copy code
list1 + "test"
is clearer
t
Ah thank you so much.