Skip to content

Instantly share code, notes, and snippets.

@sanogueralorenzo
Last active January 11, 2019 08:56
Show Gist options
  • Save sanogueralorenzo/4094f2e5e3193d3c6965d2839e38ab98 to your computer and use it in GitHub Desktop.
Save sanogueralorenzo/4094f2e5e3193d3c6965d2839e38ab98 to your computer and use it in GitHub Desktop.
data class CombinedUserPost(val user: User, val post: Post)
class UsersPostsUseCase @Inject constructor(
private val userRepository: UserRepository,
private val postRepository: PostRepository
) {
fun get(refresh: Boolean): Single<List<CombinedUserPost>> =
Single.zip(userRepository.get(refresh), postRepository.get(refresh),
BiFunction { userList, postList -> map(userList, postList) })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment