Reputation: 1920
I have an entity
data class Account (accountId, username, password, active, date...)
Now i have a list of accounts and i want to get the accountId of the account that has active = 1 (The specifications of the app ensures that there is only one account with active = 1) I tried to map the accounts with active = 1 and then i should get the accountId of the only one returned...
val activeId = accounts.map { accountDto -> accountDto.active = 1 }[0].accountId
This should work but it doesn t. How can i do it efficiently??
Upvotes: 1
Views: 2770