like I want to make an array out of all the `objec...
# getting-started
o
like I want to make an array out of all the
objects.name
from that list and use that array independently
d
You said filter so I assume you just want some of the objects? In that case:
Copy code
val arr = list.mapNotNull {
  obj -> obj.takeIf { condition }?.name
}.toTypedArray()
If you really want all, just do
list.map { it.name }.toTypedArray()
👍 1
o
ahh typedarray
i doubted that it could do what im asking thats why
i thought it changed the type of an existing array, not transform a list into an arrya