Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override fun <T> mapCarsToFavorites(
- carsList: List<T>,
- findOp: (T, HotDealsResponse) -> Boolean,
- mapOp: (T, HotDealsResponse?) -> T
- ): Flowable<List<T>> =
- database.favoritesDao().getAllFavorites.map { favorites ->
- carsList.map { car ->
- val matchingCar = favorites.find { favorite -> findOp(car, favorite) }
- if (matchingCar != null) {
- mapOp(car, matchingCar)
- }
- }
- carsList
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement