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
sealed class UiImage<out T>(val resource: T) { | |
data class LocalImage(private val imageRes: Int) : UiImage<Int>(resource = imageRes) | |
data class RemoteImage(private val imageUrl: String) : UiImage<String>(resource = imageUrl) | |
} |
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
sealed class UiImage { | |
data class LocalImage(val imageRes: Int) : UiImage() | |
data class RemoteImage(val imageUrl: String) : UiImage() | |
} |
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
class ArticleListViewModelRobot private constructor() { | |
private lateinit var viewModel: ArticleListViewModel | |
private val fakeRepository = FakeArticleRepository() | |
private fun setup() { | |
buildViewModel() | |
} | |
fun buildViewModel() = apply { |
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 main() { | |
val redSauce = RedSauce() | |
val whiteSauce = WhiteSauce() | |
val greenSauce = GreenSauce() | |
val redSaucePasta = Pasta(redSauce) | |
println(redSaucePasta.getPasta()) | |
val whiteSaucePasta = Pasta(whiteSauce) |