Created
February 13, 2018 04:42
-
-
Save AOrobator/395d47c4bdba9c6c0682deee87c76d85 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
class RealmSongRepository: SongRepository { | |
override fun getSongById(songId: SongId) : Song? = when (songId) { | |
is ValidSongId -> getSongFromRealm(songId.id) // smart cast to ValidSongId | |
InvalidSongId -> null | |
// No else statement required because the compiler knows we’ve covered all cases | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment