Hexa
10/03/2018, 3:34 PMList<Pair<PublisherMessage, deviceType>>. It currrently only returns emailMesssages: List<MessageSender>Shawn
10/03/2018, 3:41 PMShawn
10/03/2018, 3:41 PMphoneType or a deviceType is, and there’s not enough context from the screenshot to really divine what the transform looks likeShawn
10/03/2018, 3:42 PMMessageSender objectsShawn
10/03/2018, 3:42 PMPair<PublisherMessage, deviceType> instancesHexa
10/03/2018, 3:45 PMShawn
10/03/2018, 3:45 PMShawn
10/03/2018, 3:48 PMHexa
10/03/2018, 3:48 PMigor.wojda
10/03/2018, 3:48 PMmap return the Pair because map lreturns the last expression and currently you have ony one expression that creates Pair object. If you want to return something else you could just wrap it in the list
.map { pair ->
listOf(Pair(...))
}Hexa
10/03/2018, 3:48 PMHexa
10/03/2018, 3:48 PMShawn
10/03/2018, 3:55 PMPair<List<MessageSender, String>>?Hexa
10/03/2018, 3:56 PMHexa
10/03/2018, 3:59 PMdata class MyMessage(val environment: String, val phoneType: String, val phoneId: String) contains phoneType which is just a String.Shawn
10/03/2018, 4:00 PM.map { (error, messages) ->
error to messages.map { myMessage ->
MessageSender(message = myMessage.environment) to myMessage.phoneType
}
}
is perhaps what you wantHexa
10/03/2018, 4:01 PMHexa
10/03/2018, 4:10 PMShawn
10/03/2018, 4:30 PMit as a reference to the element you’re grouping byHexa
10/03/2018, 5:02 PMShawn
10/03/2018, 5:04 PMShawn
10/03/2018, 5:05 PMList<Pair<MessageSender, String>>, so we got that workingShawn
10/03/2018, 5:05 PMList<MessageSender> then, you need to apply a different transform or maybe extract the `MessageSender`s out of those pairsShawn
10/03/2018, 5:06 PMShawn
10/03/2018, 5:06 PMHexa
10/03/2018, 5:21 PMhandleMessages(messages: Map<MessageIndex, List<Pair<MessageSender, String>>>)