combine two lists and map to new class object with rxjava

Consider the following input : Calling network call will retrieve client object

data class Client(

val name: String,

val phoneNumber: String,

val frequentContacts: List,

val allContacts: List

)

what i need to do is to map similar names in frequentContacts and allContacts list in new object and subscribe on the output.

assume the response from network call will return this Client Object

{

"name": "Jack",

"phoneNumber": "90284302424",

"frequentContacts": [

"John",

"Sam"

],

"allContacts": [

"John",

"Adam",

"Peter",

"Kim",

"Sam"

]

}

what i need receive in subscribe newly create object .

data class clientViewModel(val name: String,val isFrequent: Boolean)

so in onNext i should have instance from clientViewModel

Expected output :

("John", true")

("Adam", false")

("Peter", false")

("Kim", false")...

Read More »

By: StackOverFlow - Friday, 9 November

Related Posts