Harun
07/24/2019, 12:04 PMbezrukov
07/24/2019, 12:17 PMsessionSpeakerIdList.forEach { speakerId ->
seems unused, moreover you will add duplicates to sessionModel.speakerList
2. Why sessionList.map
? It converts your list to List<Unit>. you can use onEach, if you just want to apply op on each itemval speakerById :List<SpeakersModel> = getSpeakersInfo().associateBy { it.id }
val sessionList : List<SessionsModel> = snapshots.toObjects<SessionsModel>()
sessionList.onEach { sessionModel ->
sessionModel.speakerList = sessionModel.speaker_id.mapNotNull {speakerById[it]}
}
Harun
07/24/2019, 12:22 PMsessionSpeakerIdList.forEach{speakerId ->}
am getting an array of speakerId and for eachbid am getting the speaker detailsbezrukov
07/24/2019, 12:23 PMspeakerId
thenHarun
07/24/2019, 12:26 PM