Created
June 18, 2017 12:39
-
-
Save ezura/16d080f4a48a5f64ed14e83dfd0e4c36 to your computer and use it in GitHub Desktop.
Nothing は全ての型サブタイプ && `interface List<out E>` だからこの `emptyList` の実装できるのかな (。 ・ω・)) #CodePiece #kotlin
This file contains hidden or 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 <T> listOf(vararg elements: T): List<T> = if (elements.size > 0) elements.asList() else emptyList() | |
| fun <T> emptyList(): List<T> = EmptyList | |
| object EmptyList : List<Nothing> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment