https://kotlinlang.org logo
#getting-started
Title
# getting-started
o

oday

08/26/2020, 4:46 PM
how can I turn this back into a list after doing the operation in its lambda to each of the items in the list?

https://i.imgur.com/g0mrTBN.jpg

n

nanodeath

08/26/2020, 4:50 PM
I'm not sure what
Single
is, but I suspect you want
map
, not
forEach
(which is terminal).
o

oday

08/26/2020, 5:28 PM
sorry for the late reply
ok I get what you mean
the issue is that you get back a list of items when you map

https://i.imgur.com/sLsqagh.jpg

the list itself doesnt have that extension function, but OrderResponse does
k

khalil

08/26/2020, 5:46 PM
maybe you can use something like that
Copy code
[...].getOrders().map { it?.map { it?.asOrder } }
o

oday

08/26/2020, 6:14 PM
aha, i will try
indeed
👍🏻
🤘 1
2 Views