Created
November 2, 2019 18:19
-
-
Save Kpeved/1670abc0b91f8b421ecf79aa8fd0ad05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun getAllContacts(): Single<Map<Long, ContactModel>> { | |
return Single.fromCallable { loadAllContacts() } // here we load all contacts | |
.map { addPhoneNumbers(it) } // here we add phone numbers | |
.map { it.filter { !it.value.phoneNumbers.isNullOrEmpty() } } // here we filter empty contacts | |
.map { it.values.toList().groupBy { it.contactId }.mapValues { mergePhoneNumbers(it.value) } } //here additional merging happens | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment